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 better thought 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 one in the local database is going to be called that. If you are dealing with FDWs you would have to have different names involved.
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 the catalog current" you speak of comes from. That isn't a thing that I am aware of. Where do you see this documented?