PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15883
PG Version11.4
OSAll
Opened2019-07-02 14:57:50+00
Reported byJeremy Smith
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15883
Logged by:          Jeremy Smith
Email address:      (redacted)
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();

Messages

DateAuthorSubject
2019-07-02 14:57:50+00PG Bug reporting formBUG #15883: Event Trigger Firing Matrix Table is incomplete
2019-07-28 10:45:55+00Michael PaquierRe: BUG #15883: Event Trigger Firing Matrix Table is incomplete
2019-07-28 13:04:51+00Michael PaquierRe: BUG #15883: Event Trigger Firing Matrix Table is incomplete