Re: BUG #17526: PG_DUMP is not outputting "CREATE SCHEMA" statements when an extension is assigned to a schema

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "developer(at)moregatebiotech(dot)com" <developer(at)moregatebiotech(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17526: PG_DUMP is not outputting "CREATE SCHEMA" statements when an extension is assigned to a schema
Date: 2022-06-22 14:01:52
Message-ID: 3344794.1655906512@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> Not a bug. Extension members are not dumped because the system expects
> that a subsequent create extension command will create them. That is what
> it means to be a member of the extension. Most users are not going to
> execute the “alter extension add” command on there database as it doesn’t
> 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. “Given
> control of the schema” or “Schema becomes an implementation detail of the
> extension” 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jacob Champion 2022-06-22 16:11:48 Re: BUG #17522: While using --with-ssl=openssl and PG_TEST_EXTRA='ssl' options, SSL test fails on OpenBSD 7.1
Previous Message David G. Johnston 2022-06-22 13:53:56 Re: BUG #17526: PG_DUMP is not outputting "CREATE SCHEMA" statements when an extension is assigned to a schema