Re: Event Triggers unable to capture the DDL script executed

From: Neethu P <neeth_3(at)hotmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "n(dot)kobzarev(at)aeronavigator(dot)ru" <n(dot)kobzarev(at)aeronavigator(dot)ru>, 'pgsql-general' <pgsql-general(at)postgresql(dot)org>
Subject: Re: Event Triggers unable to capture the DDL script executed
Date: 2023-02-27 03:52:36
Message-ID: MWHPR12MB1792321FB85A252ED091BBC4D1AF9@MWHPR12MB1792.namprd12.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Laurenz,

Is it possible to access the pg_ddl_command using C function? In the shared links, I couldn't find one. Can you please share an example for the same?

Thanks & Regards,
Neethu
________________________________
From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Sent: Thursday, February 23, 2023 4:20 PM
To: Neethu P <neeth_3(at)hotmail(dot)com>; n(dot)kobzarev(at)aeronavigator(dot)ru <n(dot)kobzarev(at)aeronavigator(dot)ru>; 'pgsql-general' <pgsql-general(at)postgresql(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Bilek 2023-02-27 06:28:37 ERROR: unsupported Unicode escape sequence - in JSON-type column
Previous Message Laurenz Albe 2023-02-26 20:45:03 Re: Give me details of some attributes!!