From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: jeremy@musicsmith.net
Subject: BUG #15883: Event Trigger Firing Matrix Table is incomplete
Date: Tue, 02 Jul 2019 14:57:50 +0000
Message-ID: <15883-afff0ea3cc2dbbb6@postgresql.org> (raw)
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();
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, jeremy@musicsmith.net
Subject: Re: BUG #15883: Event Trigger Firing Matrix Table is incomplete
In-Reply-To: <15883-afff0ea3cc2dbbb6@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox