pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Swathi P <swathi.bluepearl@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Query on postgres_fdw extension
Date: Fri, 14 May 2021 11:32:41 -0400
Message-ID: <1885558.1621006361@sss.pgh.pa.us> (raw)
In-Reply-To: <CALj2ACX6YarPvhXmGkVfZJZxLfAh=W+Pfub2FfKVH_5dQ0rgwQ@mail.gmail.com>
References: <CAKtL=nkXe1zXK5SMcqnzDpCON+CUPHdnjJZfZonwYQa0BDkCGQ@mail.gmail.com>
	<CALj2ACUejnxHERB4QNvKV3qVW4VQ=a8Y+kuuPTseuwq0prVe3Q@mail.gmail.com>
	<CAKtL=n=OND+AYqztr57Njanj8M9iyy6uvfmp1yX2Zgk164Ejww@mail.gmail.com>
	<1883853.1621003992@sss.pgh.pa.us>
	<CALj2ACX6YarPvhXmGkVfZJZxLfAh=W+Pfub2FfKVH_5dQ0rgwQ@mail.gmail.com>

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





view thread (18+ messages)  latest in thread

Message-ID: <1885558.1621006361@sss.pgh.pa.us>
Permalink:  ../1885558.1621006361@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1885558.1621006361@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bharath.rupireddyforpostgres@gmail.com, swathi.bluepearl@gmail.com, pgsql-general@lists.postgresql.org
  Subject: Re: Query on postgres_fdw extension
  In-Reply-To: <1885558.1621006361@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox