Re: postgresql_fdw issues with triggers on the foreign tables

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: postgresql_fdw issues with triggers on the foreign tables
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B17D1F5F2@ntex2010i.host.magwien.gv.at
обсуждение исходный текст
Ответ на postgresql_fdw issues with triggers on the foreign tables  (Eelke Klein <eelke@bolt.nl>)
Список pgsql-general
Eelke Klein wrote:
> I'm experimenting with using foreign data wrappers to get data from one database to another. Most
> things work perfectly but I am encountering two issues with triggers on the foreign tables.
> 
> The first one is when a query triggers a trigger on the foreign table the trigger doesn't have any
> search_path. Not even a select on a table in public will work from the trigger unless I specify the
> schema name.

Wouldn't a trigger that depends on the current search_path setting be
pretty dangerous anyway?  Anybody can change the setting.
I'd suggest that you make the trigger more robust.

> The second problem has to do with DEFAULT values. One of the tables i'm inserting data on has a column
> called id of type bigserial. This column is not filled by the INSERT statement I'm using so should use
> it's default which is nextval('...'::regclass); However in the BEFORE INSERT trigger the value of
> NEW.id IS NULL while normally it would already be assigned a value from the sequence.

That is actually working as intended, see this thread:
http://www.postgresql.org/message-id/24107.1363027848@sss.pgh.pa.us
Nobody could come up with a better solution.

> The issues with the triggers do not occur when they are triggered by statements executed directly on
> the database. Only when the statements come from the FDW I have these issues.

Can you reproduce the trigger problem without postgres_fdw by setting "search_path=pg_catalog" ?

Yours,
Laurenz Albe

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

Предыдущее
От: Bill Moran
Дата:
Сообщение: Re: Index usage with slow query
Следующее
От: Igor Neyman
Дата:
Сообщение: Re: postgresql_fdw issues with triggers on the foreign tables