Re: Getting the exact SQL from inside an event trigger

From: "Joe Wildish" <joe(at)lateraljoin(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org, depesz(at)depesz(dot)com
Subject: Re: Getting the exact SQL from inside an event trigger
Date: 2023-03-02 13:01:54
Message-ID: 27d484ae-98b0-44aa-8718-7fda1387b5b8@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Depesz,

On Thu, 2 Mar 2023, at 12:29, hubert depesz lubaczewski wrote:
> This might be a bit different answer from what you expect, but have you
> seen pgl_ddl_deploy project?

Thanks --- I was unaware of this project so I will take a look.

However, we are operating under a limitation that the publisher is in a hosted provider, so we cannot install extensions unless they are "blessed"; hence looking for a solution that doesn't require that.

I did go and look at what pgaudit does WRT to this problem as I know that that extension can emit just the statement being executed. I didn't fully understand all the detail, but did notice that it maintains a stack of statements for the current execution, presumably so it knows if the trigger has been called already, e.g. in the case of a DO block. This indicates to me that I can't do what I would like in pure PLPGSQL triggers.

-Joe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message cen 2023-03-02 13:20:41 Re: Postgres undeterministically uses a bad plan, how to convince it otherwise?
Previous Message hubert depesz lubaczewski 2023-03-02 12:29:02 Re: Getting the exact SQL from inside an event trigger