pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16514: pg_dump v12 puts CREATE SCHEMA public statement into the backup file
2+ messages / 2 participants
[nested] [flat]

* BUG #16514: pg_dump v12 puts CREATE SCHEMA public statement into the backup file
@ 2020-06-26 18:40 PG Bug reporting form <noreply@postgresql.org>
  2020-06-26 20:44 ` Re: BUG #16514: pg_dump v12 puts CREATE SCHEMA public statement into the backup file Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2020-06-26 18:40 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: kravtsov.k@gmail.com

The following bug has been logged on the website:

Bug reference:      16514
Logged by:          Kirill Kravtsov
Email address:      kravtsov.k@gmail.com
PostgreSQL version: 12.3
Operating system:   CentOS 7
Description:        

I’m experiencing some weird behaviour of pg_dump: based on this thread
https://www.postgresql.org/message-id/flat/20849.1541638465%40sss.pgh.pa.us#744c293b37793dea0f6e6067...
, starting from v11 pg_dump should not include CREATE SCHEMA public
statements to the dump. However, if I run pg_dump v12 with --schema public ,
it still adds that line to the backup file, which breaks the ability to
restore from it

$ /usr/pgsql-12/bin/pg_dump -d db --schema public --schema-only | grep
'CREATE SCHEMA'
CREATE SCHEMA public;

Without specifying a schema it works as expected:
$ /usr/pgsql-12/bin/pg_dump -d db --schema-only | grep 'CREATE SCHEMA'
CREATE SCHEMA admin;
CREATE SCHEMA stats;

When attempting to restore from such a backup, the following error occurs:

pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 12; 2615 2200 SCHEMA public postgres
pg_restore: error: could not execute query: ERROR:  schema "public" already
exists
Command was: CREATE SCHEMA public;



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #16514: pg_dump v12 puts CREATE SCHEMA public statement into the backup file
  2020-06-26 18:40 BUG #16514: pg_dump v12 puts CREATE SCHEMA public statement into the backup file PG Bug reporting form <noreply@postgresql.org>
@ 2020-06-26 20:44 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2020-06-26 20:44 UTC (permalink / raw)
  To: kravtsov.k@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> I’m experiencing some weird behaviour of pg_dump: based on this thread
> https://www.postgresql.org/message-id/flat/20849.1541638465%40sss.pgh.pa.us#744c293b37793dea0f6e6067...
> , starting from v11 pg_dump should not include CREATE SCHEMA public
> statements to the dump. However, if I run pg_dump v12 with --schema public ,
> it still adds that line to the backup file,

Our interpretation of that is that you've deliberately selected the
schema, so it should be dumped.

> which breaks the ability to
> restore from it

That's rather an overstatement no?  You can just ignore the "already
exists" error.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-06-26 20:44 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 18:40 BUG #16514: pg_dump v12 puts CREATE SCHEMA public statement into the backup file PG Bug reporting form <noreply@postgresql.org>
2020-06-26 20:44 ` Tom Lane <tgl@sss.pgh.pa.us>

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