Re: Event Triggers unable to capture the DDL script executed
От | Neethu P |
---|---|
Тема | Re: Event Triggers unable to capture the DDL script executed |
Дата | |
Msg-id | MWHPR12MB1792A8AC190235F0FBB8641BD1AB9@MWHPR12MB1792.namprd12.prod.outlook.com обсуждение исходный текст |
Ответ на | Re: Event Triggers unable to capture the DDL script executed (Laurenz Albe <laurenz.albe@cybertec.at>) |
Список | pgsql-general |
Thanks Laurenz. Is there any documentaion example to use the pg_ddl_command to capture the actual ddl statement (for event triggers in C)?
Regards,
Neethu
From: Laurenz Albe <laurenz.albe@cybertec.at>
Sent: Thursday, February 23, 2023 4:20 PM
To: Neethu P <neeth_3@hotmail.com>; n.kobzarev@aeronavigator.ru <n.kobzarev@aeronavigator.ru>; 'pgsql-general' <pgsql-general@postgresql.org>
Subject: Re: Event Triggers unable to capture the DDL script executed
Sent: Thursday, February 23, 2023 4:20 PM
To: Neethu P <neeth_3@hotmail.com>; n.kobzarev@aeronavigator.ru <n.kobzarev@aeronavigator.ru>; 'pgsql-general' <pgsql-general@postgresql.org>
Subject: Re: Event Triggers unable to capture the DDL script executed
On Thu, 2023-02-23 at 04:10 +0000, Neethu P wrote:
> Actually, current_query() may not help us in our case, as we won't be able
> to capture the ddl statement completely in case if it's in multiple lines.
Multiple lines should not be a problem. The problems I see are
- you won't catch DDL statements issued in a function with that, since you
only see the top-level statement
- if you have the DDL statement as string, you need to parse it, which is
non-trivial
> Can you please help me with the event trigger in C? & also how can we
> integrate it with our current postgresql DB?
In an e-mail, I cannot do much beyond pointing you to the documentation:
https://www.postgresql.org/docs/current/event-trigger-interface.html
There is also a simple example:
https://www.postgresql.org/docs/current/event-trigger-example.html
Getting used to reading and writing PostgreSQL server code takes a while.
Yours,
Laurenz Albe
> Actually, current_query() may not help us in our case, as we won't be able
> to capture the ddl statement completely in case if it's in multiple lines.
Multiple lines should not be a problem. The problems I see are
- you won't catch DDL statements issued in a function with that, since you
only see the top-level statement
- if you have the DDL statement as string, you need to parse it, which is
non-trivial
> Can you please help me with the event trigger in C? & also how can we
> integrate it with our current postgresql DB?
In an e-mail, I cannot do much beyond pointing you to the documentation:
https://www.postgresql.org/docs/current/event-trigger-interface.html
There is also a simple example:
https://www.postgresql.org/docs/current/event-trigger-example.html
Getting used to reading and writing PostgreSQL server code takes a while.
Yours,
Laurenz Albe
В списке pgsql-general по дате отправления: