Re: Query on postgres_fdw extension

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Query on postgres_fdw extension
Дата
Msg-id 1885558.1621006361@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Query on postgres_fdw extension  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-general
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> writes:
> On Fri, May 14, 2021 at 8:23 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> One conceivable workaround is to do your insertions through a
>> foreign table that doesn't even have the serial column, so that
>> the INSERT command received by the remote server lacks that
>> column and the default gets applied.  Probably too messy though.

> Then the serial column cannot be selected via the foreign table.

Yeah, you'd probably need to use different tables for inserting
and reading, which is why I called it messy.

The idea you pointed to in Michael's blog might work though,
ie make a local function that reaches over to the remote server
to get a globally-valid next sequence value, and use that as
the default expression of the foreign table.

            regards, tom lane



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

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Query on postgres_fdw extension
Следующее
От: Pól Ua Laoínecháin
Дата:
Сообщение: RETURNING, CTEs and TRANSACTION ISOLATION levels...