Re: event trigger should provide more details

Поиск
Список
Период
Сортировка
От Erik Wienhold
Тема Re: event trigger should provide more details
Дата
Msg-id 1154091521.527097.1685482957284@office.mailbox.org
обсуждение исходный текст
Ответ на event trigger should provide more details  (Lian Jiang <jiangok2006@gmail.com>)
Ответы Re: event trigger should provide more details
Список pgsql-general
> On 30/05/2023 22:23 CEST Lian Jiang <jiangok2006@gmail.com> 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



В списке pgsql-general по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Pg 16: will pg_dump & pg_restore be faster?
Следующее
От: Lian Jiang
Дата:
Сообщение: Re: event trigger should provide more details