Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbPsV-0006lw-7y for pgsql-hackers@arkaria.postgresql.org; Wed, 20 May 2020 14:39:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbPsU-0001eo-1K for pgsql-hackers@arkaria.postgresql.org; Wed, 20 May 2020 14:39:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbPsT-0001eh-QX for pgsql-hackers@lists.postgresql.org; Wed, 20 May 2020 14:39:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbPsR-0005vW-19 for pgsql-hackers@lists.postgresql.org; Wed, 20 May 2020 14:39:25 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 04KEdIcO024788; Wed, 20 May 2020 10:39:18 -0400 From: Tom Lane To: Guillaume Lelarge cc: Daniel Gustafsson , PostgreSQL Hackers Subject: Re: Extensions not dumped when --schema is used In-reply-to: References: <000780DC-6E7E-46D7-AE5A-E56405AC9204@yesql.se> Comments: In-reply-to Guillaume Lelarge message dated "Wed, 20 May 2020 11:38:21 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <24786.1589985558.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Wed, 20 May 2020 10:39:18 -0400 Message-ID: <24787.1589985558@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Guillaume Lelarge writes: > Le mer. 20 mai 2020 à 11:26, Daniel Gustafsson a écrit : >> The question is what --extensions should do: only dump any >> extensions that objects in the schema depend on; require a pattern and only >> dump matching extensions; dump all extensions (probably not) or something >> else? > Actually, "dump all extensions" (#3) would make sense to me, and has my > vote. I think that makes no sense at all. By definition, a dump that's been restricted with --schema, --table, or any similar switch is incomplete and may not restore on its own. Typical examples include foreign key references to tables in other schemas, views using functions in other schemas, etc etc. I see no reason for extension dependencies to be treated differently from those cases. In any use of selective dump, it's the user's job to select a set of objects that she wants dumped (or restored). Trying to second-guess that is mostly going to make the feature less usable for power-user cases. As a counterexample, what if you want the dump to be restorable on a system that doesn't have all of the extensions available on the source? You carefully pick out the tables that you need, which don't require the unavailable extensions ... and then pg_dump decides you don't know what you're doing and includes all the problematic extensions anyway. I could get behind an "--extensions=PATTERN" switch to allow selective addition of extensions to a selective dump, but I don't want to see us overruling the user's choices about what to dump. regards, tom lane