Disabling triggers on tables dumped with pg_extension_config_dump() - Mailing list pgsql-general

From Michel Pelletier
Subject Disabling triggers on tables dumped with pg_extension_config_dump()
Date
Msg-id CACxu=v+XNc3vVK88upwR9W_JXptG-4wq=j6Ft0FXphT64fCAoA@mail.gmail.com
Whole thread Raw
List pgsql-general
Hello,

I have an extension that contains a configuration table with a before insert trigger that I setup to dump with pg_extension_config_dump().  Because the table and trigger are setup during CREATE EXTENSION time emitted by the dump, and the dumped table is then COPY'd outside of that, the triggers get re-fired.  This doesn't happen for non-extension tables, which don't run CREATE TRIGGER until after the COPY.

Trying to find the best way to solve this problem in general for extension users so that they don't have to use --disable-triggers on the dump or restore as this seems like a rare edge case.  Can anyone suggest a better way?

I'm wondering, would it make sense to extend pg_extension_config_dump() with a disable_triggers argument, that defaults to false, and if set to true, pg_dump will emit DISABLE/ENABLE guards around the config table's COPY statement?  Just a wild idea. 

Thanks!

-Michel

pgsql-general by date:

Previous
From: Fred Habash
Date:
Subject: Re: Autovacuum Hung Due to Bufferpin
Next
From: Ron
Date:
Subject: Changing displayed time zone in RAISE NOTICE output?