Search Postgresql Archives

Re: event trigger should provide more details

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 30/05/2023 22:23 CEST Lian Jiang <jiangok2006@xxxxxxxxx> wrote:
>
> I plan to create an event trigger to detect schema change (e.g. add/remove
> a column, change column type), and write it into a separate table (e.g.
> EVENTS). Then a process periodically reads this table to send schema change
> notification. However, the event trigger (https://www.postgresql.org/docs/current/plpgsql-trigger.html)
> (43.10.2. Triggers on Events) does not provide me info such as which table
> is altered, old and new schema. Am I missing something? Thanks very much for
> any hints.

You must use ddl_command_end event triggers[0] and call function
pg_event_trigger_ddl_commands[1] to get info such as altered table and column.

[0] https://www.postgresql.org/docs/current/event-trigger-definition.html
[1] https://www.postgresql.org/docs/current/functions-event-triggers.html

--
Erik





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux