Re: Attaching database

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: Alex Theodossis <alex(at)dossi(dot)info>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Attaching database
Date: 2022-10-19 03:16:32
Message-ID: 20221019031632.75ksr5trvq7tz5uy@jrouhaud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2022-10-19 04:02:21 Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
Previous Message Igor Korot 2022-10-19 03:06:40 Re: Attaching database