Re: Attaching database - Mailing list pgsql-general

From Igor Korot
Subject Re: Attaching database
Date
Msg-id CA+FnnTyidGOq4+ctHmBz5nPQddo3xJ0RsHoyEvEGPxEKLLcLnw@mail.gmail.com
Whole thread Raw
In response to Re: Attaching database  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
Responses Re: Attaching database
Re: Attaching database
List pgsql-general
Hi, guys,

On Sun, Oct 25, 2020 at 1:27 PM Peter J. Holzer <hjp-pgsql@hjp.at> wrote:
>
> On 2020-10-19 20:21:05 +0200, Pavel Stehule wrote:
> > po 19. 10. 2020 v 20:18 odesílatel Igor Korot <ikorot01@gmail.com> napsal:
> >     On Mon, Oct 19, 2020 at 12:51 PM Pavel Stehule <pavel.stehule@gmail.com>
> >     wrote:
> >     > It is a different thing - postgresql_fdw does nested connect - it uses
> >     > client-server protocol.
> >     >
> >     > For postgres connect and sql engine process is one entity - and engine is
> >     > written without a possibility to reconnect to another database.
> >
> >     So if I understand correctly the postgresql_fdw is creating a second
> >     connection and uses it as kind of "virtualizing mechanism"
> >     in order to give access to the second database.
> >
> >
> > yes - it does new connect to somewhere (local or remote server, but mechanism
> > is absolutely same)
>
> In case this isn't clear:
>
> It is the server (or more specifically, the foreign data wrapper) which
> opens that connection. To the client it looks like it's just accessing a
> normal table within the same database.

Sorry for resurrecting this old thread...
If an attaching the DB creates new connection which will be cmpletely
independent - how the INFORMATION_SCHEMA.table@table_catalog
field is handled.

Lets say I open connection to the DB (finance) and then attached another DB
(finance_2021).

So, when I call SELECT table_schema, table_name FROM INFORMATION_SCHEMA.table
I will get all tables from (finance) DB only.
And to get all tables from (finance_2021) I need to make this catalog current
and reissue the query.

Am I right?

Thank you.

>
>         hp
>
> --
>    _  | Peter J. Holzer    | Story must make more sense than reality.
> |_|_) |                    |
> | |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
> __/   | http://www.hjp.at/ |       challenge!"



pgsql-general by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Zheap Tech Problem
Next
From: "David G. Johnston"
Date:
Subject: Re: Attaching database