Re: A few questions about foreign tables - Mailing list pgsql-general

From Ron
Subject Re: A few questions about foreign tables
Date
Msg-id 66971fc2-d49c-4c50-a8bb-a185fd543fa1@gmail.com
Whole thread Raw
In response to Re: A few questions about foreign tables  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: A few questions about foreign tables
List pgsql-general
And SELECT relnamespace::regnamespace::text, relname FROM pg_class WHERE 
relkind='f'; tells you all of the foreign tables.

Thus, this (untested) query generate all of the DROP FOREIGN TABLE statements:
SELECT format('DROP FOREIGN TABLE IF EXISTS %I.%I RESTRICT;'
               , relnamespace::regnamespace::text, relname)
FROM pg_class WHERE relkind='f'
ORDER BY relkind;

On 10/18/23 10:56, Laurenz Albe wrote:
> On Wed, 2023-10-18 at 10:24 +0200, Marcin Borkowski wrote:
>> How to revert the effect of "import foreign schema"?  Is just dropping
>> the imported tables enough?
> Running DROP FOREIGN TABLE ... for all imported tables is enough.
>
>> Also, how can I check the definitions (i.e., what tables on the server
>> they correspond to) of existing foreign tables?
> \d+ <table name>
>
>> (May I ask to be cc'd since I'm not subscribed to the list?)
> But please reply to the list.
>
> Yours,
> Laurenz Albe
>
>

-- 
Born in Arizona, moved to Babylonia.



pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: A few questions about foreign tables
Next
From: Adrian Klaver
Date:
Subject: Re: postgres keeps having blocks