5

How can I parse the pg_ddl_command field in the pg_event_trigger_ddl_commands function in the scope of ddl command end event trigger in postgres 10+?

  • 1
    It's only possible with a C function, unfortunately. See https://github.com/postgres/postgres/blob/master/src/backend/commands/event_trigger.c – Jeremy Oct 16 '19 at 16:04
  • Is there any example where someone managed to do this? – Василий Орешко Oct 17 '19 at 08:45
  • I haven't seen one, but I'd be curious to see if it you do find or create one. It could be a worthwhile extension... – Jeremy Oct 17 '19 at 12:48
  • See [here](https://stackoverflow.com/questions/23488228/how-to-get-sql-text-from-postgres-event-trigger). Use current_query() to get the currently executing command. – quickdraw Nov 06 '22 at 02:58

0 Answers0