Re: missing public on schema public

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bo Thorbjørn Jensen <bo(at)budget123(dot)dk>
Cc: pgsql-general(at)postgreSQL(dot)org, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: missing public on schema public
Date: 2017-11-14 14:57:03
Message-ID: 16507.1510671423@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?iso-8859-1?Q?Bo_Thorbj=F8rn_Jensen?= <bo(at)budget123(dot)dk> writes:
> I have some additional info and a fix.
> Firstly steps to reproduce:

Yeah, I can reproduce this. I suspect it got broken by Stephen's hacking
around with default ACLs. A simple example is

$ pg_dump -c -U postgres postgres | grep -i public
DROP SCHEMA public;
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
CREATE SCHEMA public;
ALTER SCHEMA public OWNER TO postgres;
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
COMMENT ON SCHEMA public IS 'standard public schema';
-- Name: public; Type: ACL; Schema: -; Owner: postgres
GRANT ALL ON SCHEMA public TO PUBLIC;

That's fine, but if I shove it through an archive file:

$ pg_dump -f p.dump -Fc -U postgres postgres

$ pg_restore -c p.dump | grep -i public
DROP SCHEMA public;
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
CREATE SCHEMA public;
ALTER SCHEMA public OWNER TO postgres;
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
COMMENT ON SCHEMA public IS 'standard public schema';

This is *REALLY BAD*. Quite aside from the restore being wrong,
those two sequences should never ever give different results.
Stephen, you put some filtering logic in the wrong place in pg_dump.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message rakeshkumar464 2017-11-14 16:09:07 pg_basebackup running from a remote machine
Previous Message Thomas Kellerer 2017-11-14 14:49:58 Re: Retrieve the server's time zone