Skip site navigation (1) Skip section navigation (2)

BUG #14650: pg_dump -c fails when 'public' schema doesn't exist

From: tureba(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14650: pg_dump -c fails when 'public' schema doesn't exist
Date: 2017-05-12 18:18:01
Message-ID: 20170512181801.1795.47483@wrigleys.postgresql.org (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      14650
Logged by:          Arthur Nascimento
Email address:      tureba(at)gmail(dot)com
PostgreSQL version: 9.6.3
Operating system:   Linux - CentOS 7
Description:        

Hi,

It seems that pg_dump -c fails when the database doesn't have a 'public'
schema. When using a clean database, then dropping (or renaming) the
'public' schema, a subsequent pg_dump -c tells me:

$ pg_dump -c test
pg_dump: [archiver (db)] query failed: ERROR:  schema "public" does not
exist
LINE 1: ...::regclass AND pip.objsubid = 0 AND pip.objoid <> 'public'::...
                                                             ^
pg_dump: [archiver (db)] query was: SELECT n.tableoid, n.oid, n.nspname,
(SELECT rolname FROM pg_catalog.pg_roles WHERE oid = nspowner) AS rolname,
(SELECT pg_catalog.array_agg(acl) FROM (SELECT
pg_catalog.unnest(coalesce(n.nspacl,pg_catalog.acldefault('n',n.nspowner)))
AS acl EXCEPT SELECT
pg_catalog.unnest(coalesce(pip.initprivs,pg_catalog.acldefault('n',n.nspowner))))
as foo) as nspacl, (SELECT pg_catalog.array_agg(acl) FROM (SELECT
pg_catalog.unnest(coalesce(pip.initprivs,pg_catalog.acldefault('n',n.nspowner)))
AS acl EXCEPT SELECT
pg_catalog.unnest(coalesce(n.nspacl,pg_catalog.acldefault('n',n.nspowner))))
as foo) as rnspacl, NULL as initnspacl, NULL as initrnspacl FROM
pg_namespace n LEFT JOIN pg_init_privs pip ON (n.oid = pip.objoid AND
pip.classoid = 'pg_namespace'::regclass AND pip.objsubid = 0 AND pip.objoid
<> 'public'::regnamespace)


This seems to have started in commit 330b84d8c4

A quick workaround is to create a schema called 'public' again, but I did
not expect the pg_dump error.

Thanks,
Arthur.


Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2017-05-12 18:22:20
Subject: Re: BUG #14650: pg_dump -c fails when 'public' schema doesn't exist
Previous:From: Tom LaneDate: 2017-05-12 18:13:54
Subject: Re: BUG #14649: Function Namespace Resolution Bug

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group