Thread: BUG #17576: Event_trigger ddl_command_end not firing during CREATE PROCEDURE
BUG #17576: Event_trigger ddl_command_end not firing during CREATE PROCEDURE
From
PG Bug reporting form
Date:
The following bug has been logged on the website: Bug reference: 17576 Logged by: Gabriel Rodrigues Franco Email address: gabriel.franco@quintoandar.com.br PostgreSQL version: 13.4 Operating system: Its and Amazon RDS Description: Hello PostgreSQL team, I have a FUNCTION that needs to be executed after any object creation (tables, functions, procedures...), and it is triggering as expected for any DDL operation against tables and functions, but not for PROCEDURES. CREATE EVENT TRIGGER tg_change_obj_owner ON ddl_command_end EXECUTE FUNCTION public.pg_change_obj_owner(); I saw in the Matrix that this was not supposed to happen: https://www.postgresql.org/docs/current/event-trigger-matrix.html Could you help me?
Re: BUG #17576: Event_trigger ddl_command_end not firing during CREATE PROCEDURE
From
"David G. Johnston"
Date:
On Fri, Aug 5, 2022 at 10:02 AM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:
Bug reference: 17576
Logged by: Gabriel Rodrigues Franco
Email address: gabriel.franco@quintoandar.com.br
PostgreSQL version: 13.4
Operating system: Its and Amazon RDS
Description:
Hello PostgreSQL team,
I have a FUNCTION that needs to be executed after any object creation
(tables, functions, procedures...), and it is triggering as expected for any
DDL operation against tables and functions, but not for PROCEDURES.
CREATE EVENT TRIGGER tg_change_obj_owner ON ddl_command_end
EXECUTE FUNCTION public.pg_change_obj_owner();
I saw in the Matrix that this was not supposed to happen:
https://www.postgresql.org/docs/current/event-trigger-matrix.html
Could you help me?
I cannot reproduce this.
vagrant@vagrant:/usr/local/pgsql/bin$ ./psql postgres
psql (13.4)Type "help" for help.
postgres=# create function evt_warn() returns event_trigger as $$begin raise exception 'Event'; end; $$ language plpgsql;
CREATE FUNCTION
postgres=# create table evt_table ( id serial primary key) ;
CREATE TABLE
postgres=# CREATE EVENT TRIGGER tg_change_obj_owner ON ddl_command_end
EXECUTE FUNCTION public.evt_warn();
CREATE EVENT TRIGGER
postgres=# create table evt_table ( id serial primary key) ;
ERROR: relation "evt_table" already exists
postgres=# create procedure evt_warn_proc() as $$begin raise notice 'Notice'; end;$$ language plpgsql;
ERROR: Event
CONTEXT: PL/pgSQL function evt_warn() line 1 at RAISE
postgres=#
I suggest upgrading your RDS to the most current version available, trying again, and if you still have issues contact AWS for support.
Feel free to provide a self-contained producer and output from your environment here if you'd like though. It will be informative even if the problem really is with RDS.
David J.
Re: BUG #17576: Event_trigger ddl_command_end not firing during CREATE PROCEDURE
From
"David G. Johnston"
Date:
On Fri, Aug 5, 2022 at 10:37 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
postgres=# CREATE EVENT TRIGGER tg_change_obj_owner ON ddl_command_end
EXECUTE FUNCTION public.evt_warn();
CREATE EVENT TRIGGER
postgres=# create table evt_table ( id serial primary key) ;
ERROR: relation "evt_table" already exists
Doesn't really matter but oops...
postgres=# create table evt_table_two ( id serial primary key) ;
ERROR: EventCONTEXT: PL/pgSQL function evt_warn() line 1 at RAISE
David J.