Re: [PATCH] Add pg_get_event_trigger_ddl() function - Mailing list pgsql-hackers

From Ian Lawrence Barwick
Subject Re: [PATCH] Add pg_get_event_trigger_ddl() function
Date
Msg-id CAB8KJ=gcJzPvE=KrCWEDuguoNcVupmKmSmdMVx=5vL-DtCBzxQ@mail.gmail.com
Whole thread
In response to Re: [PATCH] Add pg_get_event_trigger_ddl() function  (Zsolt Parragi <zsolt.parragi@percona.com>)
List pgsql-hackers
2026年7月18日(土) 6:26 Zsolt Parragi <zsolt.parragi@percona.com>:
>
> Hello!

Thanks for the review!

> Should the function preserve the disabled state of an event trigger?
>
> CREATE FUNCTION noop_evt() RETURNS event_trigger LANGUAGE plpgsql AS $$
> BEGIN
> END;
> $$;
> CREATE EVENT TRIGGER my_evt ON ddl_command_start EXECUTE FUNCTION noop_evt();
> ALTER EVENT TRIGGER my_evt DISABLE;
> SELECT pg_get_event_trigger_ddl('my_evt', false);
>
> also REPLICA:
>
> ALTER EVENT TRIGGER my_evt ENABLE REPLICA;
> SELECT pg_get_event_trigger_ddl('my_evt', false);
>
> and OWNER:
>
> CREATE ROLE evt_owner_role SUPERUSER;
> ALTER EVENT TRIGGER my_evt OWNER TO evt_owner_role;
> SELECT pg_get_event_trigger_ddl('my_evt');

Correct.

> +                               appendStringInfoString(&filters, ", ");
> +
> +                       appendStringInfo(&filters, "'%s'", str);
>
> Shouldn't this use quote_literal_cstr?

Arguably it wouldn't strictly need to, as we'd only ever get plain ASCII command tags here,
but it's not a critical performance choke point or anything, so might as well use it to be
on the safe side.

Updated patch version attached.

Regards

Ian Barwick
Attachment

pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: Restore vacuum_delay_point() in GIN posting-tree leaf vacuum
Next
From: Rafia Sabih
Date:
Subject: Re: [PATCH] Extending FK check skipping on replicas to ADD FK and TRUNCATE