pg_restore creates public schema?

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: pg_restore creates public schema?
Date: 2022-10-06 14:24:39
Message-ID: 9a423047-24d9-1643-c91e-6c36508b987e@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gus Spier 2022-10-06 14:49:25 Re: Postgres calendar?
Previous Message Tom Lane 2022-10-06 14:02:10 Re: Cannot convert partitioned table to a view