Re: [PATCH] Add pg_get_event_trigger_ddl() function

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Add pg_get_event_trigger_ddl() function
Date: 2026-07-20 11:10:11
Message-ID: CAB8KJ=gcJzPvE=KrCWEDuguoNcVupmKmSmdMVx=5vL-DtCBzxQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2026年7月18日(土) 6:26 Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)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 Content-Type Size
v2-0001-Add-pg_get_event_trigger_ddl-function.patch text/x-patch 16.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rafia Sabih 2026-07-20 11:18:23 Re: [PATCH] Extending FK check skipping on replicas to ADD FK and TRUNCATE
Previous Message Andrey Borodin 2026-07-20 10:45:31 Re: Restore vacuum_delay_point() in GIN posting-tree leaf vacuum