Re: [BUGS] BUG #14815: event trigger in extension

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [BUGS] BUG #14815: event trigger in extension
Дата
Msg-id 26965.1505591535@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [BUGS] BUG #14815: event trigger in extension  (gomer94@yandex.ru)
Ответы Re: [BUGS] BUG #14815: event trigger in extension  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-bugs
gomer94@yandex.ru writes:
> I want to create extension with sql like:

> CREATE OR REPLACE FUNCTION keep_any_ddl_command() RETURNS event_trigger
>     LANGUAGE plpgsql
>     AS $$
>     BEGIN
>         SELECT classid, objid, objsubid FROM
> pg_event_trigger_ddl_commands();

>         -- some insert code;
>     END;
> $$;

> CREATE TABLE ddl_events();

> CREATE EVENT TRIGGER keep_all_ddl ON ddl_command_end
>    EXECUTE PROCEDURE keep_any_ddl_command();

I think the reason this fails is that on the way out of the CREATE
EXTENSION command, the event trigger code sees that an event trigger
exists, so it tries to call it.  But because no event trigger existed
when we started the CREATE EXTENSION command, the necessary
infrastructure hasn't been set up --- in particular,
EventTriggerBeginCompleteQuery did nothing at the time.

This seems like it would be an equal hazard for any situation where
CREATE EVENT TRIGGER is executed not at top level.  Don't see an
easy fix right offhand.
        regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: [BUGS] Query planner skipping index depending on DISTINCTparameter order (2)
Следующее
От: Alexander Scott
Дата:
Сообщение: Re: [BUGS] BUG #14817: pg_dumpall is not generating create databasestatements