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 1o40vm-0003My-Dw for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jun 2022 14:02:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o40vj-0005ax-Ud for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jun 2022 14:02:03 +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 1o40vj-0005ao-Mr for pgsql-bugs@lists.postgresql.org; Wed, 22 Jun 2022 14:02:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o40vZ-00089K-Na for pgsql-bugs@lists.postgresql.org; Wed, 22 Jun 2022 14:02:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 25ME1qtr3344795; Wed, 22 Jun 2022 10:01:52 -0400 From: Tom Lane To: "David G. Johnston" cc: "developer@moregatebiotech.com" , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #17526: PG_DUMP is not outputting "CREATE SCHEMA" statements when an extension is assigned to a schema In-reply-to: References: <17526-2e7a7cf9eb165a82@postgresql.org> Comments: In-reply-to "David G. Johnston" message dated "Wed, 22 Jun 2022 06:53:56 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3344793.1655906512.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 22 Jun 2022 10:01:52 -0400 Message-ID: <3344794.1655906512@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > Not a bug. Extension members are not dumped because the system expects > that a subsequent create extension command will create them. That is wh= at > it means to be a member of the extension. Most users are not going to > execute the =E2=80=9Calter extension add=E2=80=9D command on there datab= ase as it doesn=E2=80=99t > really provide end-user useful functionality. Yeah. Correct use of this option would be to put the CREATE SCHEMA command in an extension upgrade script. (Notionally, you could also write "alter extension ... add schema ..." in that script, but the extension script execution mechanism takes care of that for you.) > Extension assigned to a schema is not the correct model here. =E2=80=9C= Given > control of the schema=E2=80=9D or =E2=80=9CSchema becomes an implementat= ion detail of the > extension=E2=80=9D are. If you want to put the extension's objects into a user-selected schema, you just create the schema and do "create extension ... with schema ...". It is not correct to then do "alter extension ... add schema", because in this approach the schema does not "belong to" the extension. regards, tom lane