Обсуждение: Error bundling script file with extension when event trigger commandsare used

Поиск
Список
Период
Сортировка

Error bundling script file with extension when event trigger commandsare used

От
sanyam jain
Дата:

Hi,

I am trying to bundle a script file with my extension. Script has event triggers and trigger function does a select query on pg_event_trigger_ddl_commands .

While executing "create extension" following error is thrown :


ERROR:  pg_event_trigger_ddl_commands() can only be called in an event trigger function
CONTEXT:  SQL statement "SELECT * FROM pg_event_trigger_ddl_commands() WHERE object_type ='table'


Found that there is already a bug posted related to this 

I couldn't understand much from the above thread but like to solve this problem.

Thanks,
Sanyam Jain

Re: Error bundling script file with extension when event triggercommands are used

От
Michael Paquier
Дата:
On Wed, Dec 6, 2017 at 3:36 PM, sanyam jain <sanyamjain22@live.in> wrote:
> I couldn't understand much from the above thread but like to solve this
> problem.

Not sure that people are much motivated in solving this problem either
as the use-case is very narrow. Based on my memories of the moment
where I looked at this problem, I was thinking that you would need
additional catalog functions able to switch a session-level flag which
disables completely event triggers to happen during the execution of
those commands... So it would mean that such a fix cannot be
back-patched. If you would like to design or implement a patch, of
course feel free! One hacky way to solve this problem would be to
create the event triggers out of the extension creation, meaning that
the object dependencies would need to be tracked by yourself.
-- 
Michael