Re: Attaching database - Mailing list pgsql-general

From Julien Rouhaud
Subject Re: Attaching database
Date
Msg-id 20221019031632.75ksr5trvq7tz5uy@jrouhaud
Whole thread Raw
In response to Re: Attaching database  (Igor Korot <ikorot01@gmail.com>)
List pgsql-general
Hi,

On Tue, Oct 18, 2022 at 10:06:40PM -0500, Igor Korot wrote:
> Hi, guys,
> After reading the documentation on
> https://www.postgresql.org/docs/current/postgres-fdw.html
> and checking the example I have a different question.
>
> The presentation in the link referenced doesn't explain how to get the
> table list on the
> remote server and the information on the specific table.
>
> The example tals about connection and creating a linked table, but it
> doesn't explain
> how to know the information about the tables on the remote
>
> Is it possible or I will have to know this beforehand?

In general it's up to you to make sure that the remote table definition matches
the local one.  You can use IMPORT FOREIGN SCHEMA (1) to automate this process,
but you will still have to make sure that any subsequent modification on the
remote table (added/removed column, changed datatype...) is also done on the
local foreign table.

> (Sorry for the top-posting).

This isn't really related to the previous discussion so it's quite ok, although
it's usually a good practice to trim the unwanted parts of the previous
message (in this case the whole previous message).

[1] https://www.postgresql.org/docs/current/sql-importforeignschema.html



pgsql-general by date:

Previous
From: Igor Korot
Date:
Subject: Re: Attaching database
Next
From: Christophe Pettus
Date:
Subject: Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP