pg_restore creates public schema? - Mailing list pgsql-general

From Ron
Subject pg_restore creates public schema?
Date
Msg-id 9a423047-24d9-1643-c91e-6c36508b987e@gmail.com
Whole thread Raw
Responses Re: pg_restore creates public schema?
List pgsql-general
pg_dump 9.6.24
pg_restore 13.8

Why does pg_restore explicitly create "public" even though public is 
automatically created when the database is created?

I noticed that when using "--exit-on-error".  It's disappointing, because I 
had to remove that option, which caused the restore to ignore other, 
actually important errors.)

$ cd /var/lib/pgsql/backups/dumps/2022-10-04
$ pg_restore -vcC --if-exists --jobs=12 -Fd -d postgres CDSLBXW

pg_restore: connecting to database for restore
pg_restore: dropping DATABASE CDSLBXW
pg_restore: processing item 10813 ENCODING ENCODING
pg_restore: processing item 10814 STDSTRINGS STDSTRINGS
pg_restore: processing item 10815 SEARCHPATH SEARCHPATH
pg_restore: processing item 10816 DATABASE CDSLBXW
pg_restore: creating DATABASE "CDSLBXW"
pg_restore: connecting to new database "CDSLBXW"
pg_restore: processing item 14 SCHEMA cds
pg_restore: creating SCHEMA "cds"
pg_restore: processing item 18 SCHEMA dba
pg_restore: creating SCHEMA "dba"
pg_restore: processing item 10 SCHEMA public
pg_restore: creating SCHEMA "public"
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 10; 2615 2200 SCHEMA public postgres
pg_restore: error: could not execute query: ERROR:  schema "public" already 
exists
Command was: CREATE SCHEMA public;



-- 
Angular momentum makes the world go 'round.



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Cannot convert partitioned table to a view
Next
From: Gus Spier
Date:
Subject: Re: Postgres calendar?