BUG #15883: Event Trigger Firing Matrix Table is incomplete
The Post Office <noreply@postgresql.org>
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: jeremy@musicsmith.net
Date: 2019-07-02T14:57:50Z
Lists: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 15883
Logged by: Jeremy Smith
Email address: jeremy@musicsmith.net
PostgreSQL version: 11.4
Operating system: All
Description:
The event trigger firing matrix table in the documentation:
https://www.postgresql.org/docs/11/event-trigger-matrix.html#EVENT-TRIGGER-BY-COMMAND-TAG
claims to list all commands for which event triggers are supported.
However, there are several triggers in the source code
(https://github.com/postgres/postgres/blob/REL_11_STABLE/src/backend/commands/event_trigger.c#L290)
that are not listed in this table.
They are:
- REFRESH MATERIALIZED VIEW
- ALTER DEFAULT PRIVILEGES
- ALTER LARGE OBJECT
- DROP OWNED
- IMPORT FOREIGN SCHEMA
I have tried creating a trigger on refresh materialized view, which seems to
work, so I believe this is a documentation issue:
CREATE TABLE public.mview_refresh_log(
mview regclass PRIMARY KEY,
last_refresh timestamp without time zone
);
CREATE OR REPLACE FUNCTION public.log_mview_refresh()
RETURNS event_trigger AS
$$
BEGIN
INSERT INTO mview_refresh(mview, last_refresh)
SELECT objid, now()
FROM pg_event_trigger_ddl_commands()
ON CONFLICT (mview) DO UPDATE SET last_refresh = EXCLUDED.last_refresh;
END;
$$ LANGUAGE plpgsql;
CREATE EVENT TRIGGER log_mview_refresh_trig
ON ddl_command_end
WHEN TAG IN ('REFRESH MATERIALIZED VIEW')
EXECUTE FUNCTION log_mview_refresh();
Commits
-
Doc: Fix event trigger firing table
- 5f2a94a38d24 9.4.24 landed
- d452d0cf6fd3 9.5.19 landed
- 484a4667bbed 9.6.15 landed
- e9ecf736e121 10.10 landed
- 0e8f927fa6bb 11.5 landed
- e396d1ee7db5 12.0 landed
- 44460d7017cd 13.0 landed