pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: peter.borissow@kartographia.com <peter.borissow@kartographia.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Inserting into foreign table with sequences and default values
Date: Fri, 08 Dec 2023 13:31:46 -0500
Message-ID: <1468017.1702060306@sss.pgh.pa.us> (raw)
In-Reply-To: <1702058638.91064408@apps.rackspace.com>
References: <1702058638.91064408@apps.rackspace.com>

"peter.borissow@kartographia.com" <peter.borissow@kartographia.com> writes:
> I guess the FDW is not "seeing" the default value for status and the bigserial sequence for the id column. Is there anyway around this?

The idea is that you should attach default clauses to the foreign
table definition.  A remote serial column is a hard case for that,
though, since you don't have ready access to the remote sequence.
Because of that and some related examples, we don't currently
expect that IMPORT FOREIGN SCHEMA should import the defaults that
exist on the remote server.

Using a view or trigger on the remote side is currently the best
way around that for cases where you can't set up a suitable
default on the local table.

			regards, tom lane





view thread (4+ messages)  latest in thread

Message-ID: <1468017.1702060306@sss.pgh.pa.us>
Permalink:  ../1468017.1702060306@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1468017.1702060306@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, peter.borissow@kartographia.com
  Subject: Re: Inserting into foreign table with sequences and default values
  In-Reply-To: <1468017.1702060306@sss.pgh.pa.us>
  References: <1702058638.91064408@apps.rackspace.com> <1468017.1702060306@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