pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: pg_restore creates public schema?
Date: Thu, 6 Oct 2022 09:24:39 -0500
Message-ID: <9a423047-24d9-1643-c91e-6c36508b987e@gmail.com> (raw)

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.





view thread (20+ messages)  latest in thread

Message-ID: <9a423047-24d9-1643-c91e-6c36508b987e@gmail.com>
Permalink:  ../9a423047-24d9-1643-c91e-6c36508b987e@gmail.com/
Also on:    postgresql.org/message-id/9a423047-24d9-1643-c91e-6c36508b987e@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: pg_restore creates public schema?
  In-Reply-To: <9a423047-24d9-1643-c91e-6c36508b987e@gmail.com>
  References: <9a423047-24d9-1643-c91e-6c36508b987e@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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