It's not useful in case of nested commands (maybe in other cases too);
rely on pg_event_trigger_get_creation_commands().command_tag instead.
pg_catalog.pg_event_trigger_expand_command(r.command),
'false');
- IF TG_TAG = 'CREATE TABLE' and r.object_type = 'table' THEN
+ IF r.command_tag = 'CREATE TABLE' and r.object_type = 'table' THEN
EXECUTE 'CREATE TRIGGER truncate_trigger AFTER TRUNCATE ON ' ||
r.identity ||
' FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()';