Re: Attaching database - Mailing list pgsql-general

From Igor Korot
Subject Re: Attaching database
Date
Msg-id CA+FnnTwpYGt1D0bEVw6n2nRJZrzHfySOtGy4ugoTU1BnG_isjQ@mail.gmail.com
Whole thread Raw
In response to Re: Attaching database  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Attaching database
Re: Attaching database
List pgsql-general
Hi, David et al,

On Fri, Oct 14, 2022 at 11:39 PM David G. Johnston
<david.g.johnston@gmail.com> wrote:
>
> On Fri, Oct 14, 2022 at 9:17 PM Igor Korot <ikorot01@gmail.com> wrote:
>>
>> 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:
>>
>> > 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...
>
>
> Then why did you do it?  You couldn't send a new email without copying possibly no longer interested people and with
betterthought out self-contained content that simply notes you are somehow using an FDW.
 
>
>>
>> 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
>
>
> Call this how exactly? There are three information_schema instances that you can be talking about, though only the
onein the local database is going to be called that.  If you are dealing with FDWs you would have to have different
namesinvolved.
 
>
>>
>> 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?
>
>
> Do it and find out?  Then if still confused, show what you attempted.  But I don't know what this concept of "make
thecatalog current" you speak of comes from.  That isn't a thing that I am aware of.  Where do you see this
documented?

Making catalog current means switching between DBs.
Remember initially I connected to (finance) DB, which made the (finance) catalog
current.
Then I "opened a second connection" to (finance_2021), which made
that current catalog and so that select would give me all tables from
(finance_2021).

I hope now its clearer.

Thank you.

>
> David J.



pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Attaching database
Next
From: "David G. Johnston"
Date:
Subject: Re: Attaching database