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