2

I'd like to write a Postgres event trigger to capture the name and schema of a table before it is created, using ddl_command_start. However, it seems like this is only available from pg_event_trigger_ddl_commands(), which can only be called at ddl_command_end.

Is there any way to get the table name at ddl_command_start ?

dbaston
  • 903
  • 1
  • 10
  • 20
  • The function is not available on `dll_command_start` as the object does not exist yet. What's the reason that you cannot use `ddl_command_end`? – klin Feb 01 '18 at 18:47
  • @klin you can easily argue that it's a bad idea, but I ended up writing the trigger in C (where the names are indeed available), see https://github.com/dbaston/pg_implicit_schema – dbaston Feb 01 '18 at 19:06
  • I don't think it's a bad idea. It may be useful in the described case. And you need a C function indeed. – klin Feb 01 '18 at 19:24

0 Answers0