pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Locked out of schema public (pg_dump lacks backup of the grant)
3+ messages / 2 participants
[nested] [flat]
* Re: Locked out of schema public (pg_dump lacks backup of the grant)
@ 2019-11-06 20:49 Peter <pmc@citylink.dinoex.sub.org>
2019-11-06 21:36 ` Re: Locked out of schema public (pg_dump lacks backup of the grant) Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Peter @ 2019-11-06 20:49 UTC (permalink / raw)
To: pgsql-general
Long story short:
pg_dump just forgets to backup the grant on schema public. :(
Long story:
After searching for half an hour to get some comprehensive listing
of permissions (which was in vain) I tried with pgadmin3 (which is
indeed a life-saver and still somehow works on 10.10 - and that's
the reason I am reluctant to upgrade postgres, as this can only get
worse) - and then it was a simple action of comparing page-by-page:
GRANT ALL ON SCHEMA public TO public;
That one is missing on the restored database.
So, if you do a "pg_restore -C -c -d postgres", then you get that
grant from the template database, and no problem. (But this is ugly,
as you need to find and terminate all the connections on the db.)
If you do only "pg_restore -c -d <db>", the sessions can stay open,
but then it will do
DROP SCHEMA public;
CREATE SCHEMA public;
and it will NOT restore the grant because it is not in the backup.
I'd like to call this a bug.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Locked out of schema public (pg_dump lacks backup of the grant)
2019-11-06 20:49 Re: Locked out of schema public (pg_dump lacks backup of the grant) Peter <pmc@citylink.dinoex.sub.org>
@ 2019-11-06 21:36 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2019-11-06 21:36 UTC (permalink / raw)
To: Peter <pmc@citylink.dinoex.sub.org>; +Cc: pgsql-general
Peter <pmc@citylink.dinoex.sub.org> writes:
> If you do only "pg_restore -c -d <db>", the sessions can stay open,
> but then it will do
> DROP SCHEMA public;
> CREATE SCHEMA public;
> and it will NOT restore the grant because it is not in the backup.
We improved that situation in v11, I believe. What I see for this
case these days is per commit 5955d9341:
Also, change the very ad-hoc mechanism that was used to avoid dumping
creation and comment commands for the public schema. Instead of hardwiring
a test in _printTocEntry(), make use of the DUMP_COMPONENT_ infrastructure
to mark that schema up-front about what we want to do with it. This has
the visible effect that the public schema won't be mentioned in the output
at all, except for updating its ACL if it has a non-default ACL.
Previously, while it was normally not mentioned, --clean mode would drop
and recreate it, again causing headaches for non-superuser usage. This
change likewise makes the public schema less special and more like other
built-in objects.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Locked out of schema public (pg_dump lacks backup of the grant)
@ 2019-11-06 22:14 Peter <pmc@citylink.dinoex.sub.org>
0 siblings, 0 replies; 3+ messages in thread
From: Peter @ 2019-11-06 22:14 UTC (permalink / raw)
To: pgsql-general
Hello Tom,
thank You very much.
> We improved that situation in v11, I believe. What I see for this
> case these days is per commit 5955d9341:
> [...]
Ah, well. I don't fully understand that, but as the iessue appears to
be known, then that is fine with me.
This thing is just bad if one never seriously worked with schemas and
has no immediate idea what could have hit - especially when that happens
on the top of a stack of open windows with other issues. :(
cheers,
PMc
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2019-11-06 22:14 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 20:49 Re: Locked out of schema public (pg_dump lacks backup of the grant) Peter <pmc@citylink.dinoex.sub.org>
2019-11-06 21:36 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-11-06 22:14 Re: Locked out of schema public (pg_dump lacks backup of the grant) Peter <pmc@citylink.dinoex.sub.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox