Re: Inserting into foreign table with sequences and default values - Mailing list pgsql-general

From Tom Lane
Subject Re: Inserting into foreign table with sequences and default values
Date
Msg-id 1468017.1702060306@sss.pgh.pa.us
Whole thread Raw
In response to Inserting into foreign table with sequences and default values  ("peter.borissow@kartographia.com" <peter.borissow@kartographia.com>)
Responses Re: Inserting into foreign table with sequences and default values  ("peter.borissow@kartographia.com" <peter.borissow@kartographia.com>)
List pgsql-general
"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
anywayaround 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



pgsql-general by date:

Previous
From: Vincent Veyron
Date:
Subject: Re: running \copy through perl dbi ?
Next
From: "Peter J. Holzer"
Date:
Subject: Re: Store PDF files in PostgreDB