Skip to content

Instantly share code, notes, and snippets.

@achampav
Created November 16, 2018 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achampav/450d41673cc5162e9a7cde3021397038 to your computer and use it in GitHub Desktop.
Save achampav/450d41673cc5162e9a7cde3021397038 to your computer and use it in GitHub Desktop.
declare
l_obj record;
l_table_name character varying := '';
...
begin
...
for l_obj in select * from pg_event_trigger_ddl_commands()
loop
if l_obj.command_tag = 'CREATE TABLE' then
l_table_name = substr(l_obj.object_identity,position('.' in l_obj.object_identity) + 1);
...
end loop;
...
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment