From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | jeremy(at)musicsmith(dot)net |
Subject: | BUG #15883: Event Trigger Firing Matrix Table is incomplete |
Date: | 2019-07-02 14:57:50 |
Message-ID: | 15883-afff0ea3cc2dbbb6@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15883
Logged by: Jeremy Smith
Email address: jeremy(at)musicsmith(dot)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();
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2019-07-02 15:04:15 | BUG #15884: json_object_agg errors on null in field name |
Previous Message | David Rowley | 2019-07-02 13:13:25 | Re: GROUP BY and inheritance issue |