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 1lWeg0-0003cx-B3 for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Apr 2021 12:31:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lWefz-0002xC-89 for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Apr 2021 12:31:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lWefy-0002x0-Pv for pgsql-hackers@lists.postgresql.org; Wed, 14 Apr 2021 12:31:23 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lWefw-0007Gf-5O for pgsql-hackers@lists.postgresql.org; Wed, 14 Apr 2021 12:31:21 +0000 Received: by mail-pl1-x62b.google.com with SMTP id w8so7673911plg.9 for ; Wed, 14 Apr 2021 05:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=izxA1B5PdB9OKXEH/O09X0QpxMuGpV7B09rtk5xXH9s=; b=SN4p4m9QrkPuEwMlobL49L+KeDOWXFZlW763IVB5IwVM5rhOaVwxZ9nDVY7A/tK/jd RXZ2dnB9VyTRoHtjjlmyldtGe4XFbpLkDp2fqxwR7G6jFG9mR1evN6rq7Rc9v62igiwX gI7Xeuim0zXV2MKqhlAHo3wifhOK5iVhnjgT8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=izxA1B5PdB9OKXEH/O09X0QpxMuGpV7B09rtk5xXH9s=; b=KNqvxNjN/cRLR7snd6nRIZNxYpJQPe1uKEbWh1g5NzfkPdSqRc/ACxNxXSTTmArSwz 0kUSqEA5MaTUwcShJd8o2jwZzwFeHtDAIhXwyxVldy69ylOHQpt1ak+otBuL7Y4snIDD flGQ/lfSPAsFyNc1L7t2SORz33kCe4Tqh+8cmX4kyg5iHCPDRtFln3MB6A6wfTEQgv96 9khEdyO/S2wTT2lKFDYvwKAS1S9kg17z1ZxOglOU5+5QvVrNQ9eoOXePoKhuezxxcYzj OeR+ze4AVHnMWtroH9TUpxGtCz3yYlPBVhvIkSJFMClImURFNrcHMGOTYq3KstDmJhNu bRHQ== X-Gm-Message-State: AOAM533E/tn6KdGc39l1enwzQG7FnZV0m3z/KW2eBRFUF3lVD7wn0Oeq tlvRJvgOVRlOLLEvewvdtb+m3A== X-Google-Smtp-Source: ABdhPJy+s5wOICzDu9Nl3rAH/kolFqVRGlSRpOYZ3+iGXCT9FwuuAGgS6SAI5ztNu8N0Ldmbmvl2Zw== X-Received: by 2002:a17:902:6b05:b029:e9:2810:7e59 with SMTP id o5-20020a1709026b05b02900e928107e59mr38302324plk.76.1618403478949; Wed, 14 Apr 2021 05:31:18 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::46]) by smtp.gmail.com with ESMTPSA id b136sm9590429pfb.126.2021.04.14.05.31.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Apr 2021 05:31:17 -0700 (PDT) Date: Wed, 14 Apr 2021 05:31:15 -0700 From: Noah Misch To: Michael Paquier Cc: Guillaume Lelarge , Julien Rouhaud , Tom Lane , Daniel Gustafsson , PostgreSQL Hackers Subject: Re: Extensions not dumped when --schema is used Message-ID: <20210414123115.GA1263822@rfd.leadboat.com> References: <20210315102155.qgp32wo6tcuu6w4l@nol> <20210404220802.GA728316@rfd.leadboat.com> <20210413150034.GA1218136@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 14, 2021 at 10:38:17AM +0900, Michael Paquier wrote: > On Tue, Apr 13, 2021 at 08:00:34AM -0700, Noah Misch wrote: > > On Tue, Apr 13, 2021 at 02:43:11PM +0900, Michael Paquier wrote: > >>> - If extschema='public', "pg_dump -e plpgsql --schema=public" includes > >>> commands to dump the relation data. This surprised me. (The > >>> --schema=public argument causes selectDumpableNamespace() to set > >>> nsinfo->dobj.dump=DUMP_COMPONENT_ALL instead of DUMP_COMPONENT_ACL.) > > This isn't a problem of selecting schemas for inclusion in the dump. This is > > a problem of associating extensions with their pg_extension_config_dump() > > relations and omitting those extension-member relations when "-e" causes > > omission of the extension. > > At code level, the decision to dump the data of any extension's > dumpable table is done in processExtensionTables(). I have to admit > that your feeling here keeps the code simpler than what I have been > thinking if we apply an extra filtering based on the list of > extensions in this code path. So I can see the value in your argument > to not dump at all the data of an extension's dumpable table as long > as its extension is not listed, and this, even if its schema is > explicitly listed. > > So I got down to make the behavior more consistent with the patch > attached. This passes your case. Yes. > It is worth noting that if a > table is part of a schema created by an extension, but that the table > is not dependent on the extension, we would still dump its data if > using --schema with this table's schema while the extension is not > part of the list from --extension. In the attached, that's just the > extra test with without_extension_implicit_schema. That's consistent with v13, and it seems fine. I've not used a non-test extension that creates a schema. > --- a/src/test/modules/test_pg_dump/t/001_base.pl > +++ b/src/test/modules/test_pg_dump/t/001_base.pl > @@ -208,6 +208,30 @@ my %pgdump_runs = ( > 'pg_dump', '--no-sync', "--file=$tempdir/without_extension.sql", > '--extension=plpgsql', 'postgres', > ], > + }, > + > + # plgsql in the list of extensions blocks the dump of extension > + # test_pg_dump. > + without_extension_explicit_schema => { > + dump_cmd => [ > + 'pg_dump', > + '--no-sync', > + "--file=$tempdir/without_extension_explicit_schema.sql", > + '--extension=plpgsql', > + '--schema=public', > + 'postgres', > + ], > + }, > + > + without_extension_implicit_schema => { > + dump_cmd => [ > + 'pg_dump', > + '--no-sync', > + "--file=$tempdir/without_extension_implicit_schema.sql", > + '--extension=plpgsql', > + '--schema=regress_pg_dump_schema', > + 'postgres', > + ], > },); The name "without_extension_explicit_schema" arose because that test differs from the "without_extension" test by adding --schema=public. The test named "without_extension_implicit_schema" differs from "without_extension" by adding --schema=regress_pg_dump_schema, so the word "implicit" feels not-descriptive of the test. I recommend picking a different name. Other than that, the change looks good.