Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qt9C8-00B1y3-RN for pgsql-general@arkaria.postgresql.org; Wed, 18 Oct 2023 16:14:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qt9C5-005zgN-Sv for pgsql-general@arkaria.postgresql.org; Wed, 18 Oct 2023 16:14:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qt9C5-005zgE-Hw for pgsql-general@lists.postgresql.org; Wed, 18 Oct 2023 16:14:50 +0000 Received: from mail-yb1-xb2d.google.com ([2607:f8b0:4864:20::b2d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qt9C2-001OF4-Du for pgsql-general@lists.postgresql.org; Wed, 18 Oct 2023 16:14:49 +0000 Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-d9ad67058fcso7444203276.1 for ; Wed, 18 Oct 2023 09:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697645685; x=1698250485; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=wsR+Z/xpxIVBBRepKyPPUQTB5dlsNhX85yy2DU7HJN4=; b=lIvbV9DwOOS9HyEISr3ZS9Bszu/jOI2xQvk65wZU6SvwFPhdZVGEBzU+hgXHoFmVc/ vJBjpGWQKrz7O+eu1siYAOfdnhKhndfgG2mk/C5wh8A4+adQNV6F3E1p+DZ3qchKCA22 FLFKGuW5prbAKqQFrPZIwzMhpFSgyyjlUQABlJ2he+OjEUySLJpRFvWMwGhjUWfr2lkb M2nuFnP+2Qqfffi0CWYENB6eLRh2sRBUFS/PQ16ozrEwwIHYoc0m/ooGZFphKlx73PG+ MKdDUK2Zuhi/0h7ZdxZd8kit1GqGAFiv1wB1KRxon6zB8NbuqNNEkCmnvq/VTMZIFhuX Ev5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697645685; x=1698250485; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wsR+Z/xpxIVBBRepKyPPUQTB5dlsNhX85yy2DU7HJN4=; b=IjpEUF6wuFVovTEe05X5Gc968RfOqZcbmTczWkTCLfzOoMpKeKRkRPbP5/sxumkNrQ Tt3/I167X1v09OM7/R2sSLKNAWbZ6KrnPYfwh0UqwChx79Q7+ALprUMiAcqJRis9xwb3 8zE/QEGLygT7GEWuud7r1MwktGEetBjldyJam4UDMtci/YbVsIvuzxYmQJOjWs5vA14j sJAbsJYPuWgJUIMhp/DjQupXwRr7MpX00GhhfMx608ghUHWxFLWovgdt7+5shLS/3VGn SoNlmcmsSEsUy9E+yuPMwn+TWTdsTur15taQ0nDq5bM7iSnjDwxJ5njb8R4SHqsV5YID FZUQ== X-Gm-Message-State: AOJu0Yx/p4FnFBeFbG/58vdcHwSEhBoejoNrC0nQiUVFwFOZkTsliqxW zBNl56DCEIo70f05gtwFe9qqpX0/tXE= X-Google-Smtp-Source: AGHT+IHb0p4MXtjzJGPgdGfD4czn083Du+JcqpkZmPexb9+77nik9/Y1hR4yq8WOEAt+9G/FKXkgBw== X-Received: by 2002:a25:d84e:0:b0:d9a:3dbd:1f0 with SMTP id p75-20020a25d84e000000b00d9a3dbd01f0mr5553838ybg.21.1697645685487; Wed, 18 Oct 2023 09:14:45 -0700 (PDT) Received: from ?IPV6:2600:1700:bd2c:b810:3d15:81b3:3a0:4d09? ([2600:1700:bd2c:b810:3d15:81b3:3a0:4d09]) by smtp.googlemail.com with ESMTPSA id a36-20020a25ae24000000b00babcd913630sm1410906ybj.3.2023.10.18.09.14.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Oct 2023 09:14:45 -0700 (PDT) Message-ID: <66971fc2-d49c-4c50-a8bb-a185fd543fa1@gmail.com> Date: Wed, 18 Oct 2023 11:14:44 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: A few questions about foreign tables Content-Language: en-US To: Marcin Borkowski , pgsql-general@lists.postgresql.org References: <87bkcws5i3.fsf@mbork.pl> <4e7b5deef8b8e5e603bcb9dc32fc20e84bb95419.camel@cybertec.at> From: Ron In-Reply-To: <4e7b5deef8b8e5e603bcb9dc32fc20e84bb95419.camel@cybertec.at> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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+ > >> (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.