Re: Inserting into foreign table with sequences and default values

2023-12-08 Thread peter.boris...@kartographia.com
Correction: the trigger on the remote table isn't going to work. I was trying so many different things today that I confused myself. Sorry... On the bright side the remote sequence works great and I can insert records from the my database to the remote database now which is a step forward. I

Re: Inserting into foreign table with sequences and default values

2023-12-08 Thread peter.boris...@kartographia.com
Thanks Tom, Your reply helped point me in the right direction. With a little trial and error I came up with a hack to solve my issue. First off, I create a shared sequence for the user_id with a technique described here: [ https://paquier.xyz/postgresql-2/global-sequences-with-postgres_fdw

Re: Inserting into foreign table with sequences and default values

2023-12-08 Thread Tom Lane
"peter.boris...@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 h

Inserting into foreign table with sequences and default values

2023-12-08 Thread peter.boris...@kartographia.com
Hello, I have a few questions inserting data using Foreign Data Wrappers (FDW). Consider this simple example. On PostgreSQL Database A (remote): CREATE TABLE APP.TEST ( ID BIGSERIAL NOT NULL, FIRST_NAME text, LAST_NAME text, STATUS integer NOT NULL DEFAULT 1, CONSTRAINT