Thread: pgsql: Fix pg_dump to dump shell types.

pgsql: Fix pg_dump to dump shell types.

From
Tom Lane
Date:
Fix pg_dump to dump shell types.

Per discussion, it really ought to do this.  The original choice to
exclude shell types was probably made in the dark ages before we made
it harder to accidentally create shell types; but that was in 7.3.

Also, cause the standard regression tests to leave a shell type behind,
for convenience in testing the case in pg_dump and pg_upgrade.

Back-patch to all supported branches.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/5d175be17b46374f7aaf15b2fc6b0ac5d75a3467

Modified Files
--------------
src/bin/pg_dump/pg_dump.c                 |   68 ++++++++++++++++++++++++++---
src/bin/pg_dump/pg_dump.h                 |    2 +-
src/test/regress/expected/create_type.out |    2 +
src/test/regress/sql/create_type.sql      |    3 ++
4 files changed, 68 insertions(+), 7 deletions(-)


Re: pgsql: Fix pg_dump to dump shell types.

From
Andrew Dunstan
Date:

On 08/04/2015 07:34 PM, Tom Lane wrote:
> Fix pg_dump to dump shell types.
>
> Per discussion, it really ought to do this.  The original choice to
> exclude shell types was probably made in the dark ages before we made
> it harder to accidentally create shell types; but that was in 7.3.
>
> Also, cause the standard regression tests to leave a shell type behind,
> for convenience in testing the case in pg_dump and pg_upgrade.
>
> Back-patch to all supported branches.
>
>


Still not quite there. If either 9.0 or 9.1 is upgraded to 9.2 or later,
they fail like this:

    pg_restore: creating TYPE "public"."myshell"
    pg_restore: setting owner and privileges for TYPE "public"."myshell"
    pg_restore: setting owner and privileges for ACL "public"."myshell"
    pg_restore: [archiver (db)] Error from TOC entry 4293; 0 0 ACL
    myshell buildfarm
    pg_restore: [archiver (db)] could not execute query: ERROR:  type
    "myshell" is only a shell
         Command was: REVOKE ALL ON TYPE "myshell" FROM PUBLIC;
    REVOKE ALL ON TYPE "myshell" FROM "buildfarm";
    GRANT ALL ON TYPE "myshell" TO PUBL...


We could just declare that we don't support this for versions older than
9.2, in which case I would just remove the type from the test database
before testing cross-version upgrade. But if it's easily fixed then
let's do it.

cheers

andrew