From: Tom Lane <tgl@sss.pgh.pa.us>
To: raf <raf@raf.org>
Cc: pgsql-general@postgresql.org
Subject: Re: pg_restore: error: schema "public" already exists
Date: Tue, 27 Oct 2020 22:28:29 -0400
Message-ID: <1219519.1603852109@sss.pgh.pa.us> (raw)
In-Reply-To: <20201028014514.xel46ej4uy3bxdgs@raf.org>
References: <20201028014514.xel46ej4uy3bxdgs@raf.org>
raf <raf@raf.org> writes:
> A colleague is getting this error when trying to load a
> database dump:
> pg_restore: error: could not execute query: ERROR: schema "public" already exists
> I'm wondering if anyone can explain it.
The public schema is a bit of a strange beast, and pg_dump has to
special-case it in some ways. We've moved those special cases around
from time to time, too. So one likely explanation here has to do
with version discrepancies between the pg_dump that made the dump
file and the pg_restore that's restoring it.
Also, I do not think that you're telling us the whole truth about
how your colleague is running pg_dump and/or pg_restore. There
shouldn't be any "CREATE SCHEMA public" issued if you didn't say -c.
regards, tom lane
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: tgl@sss.pgh.pa.us, raf@raf.org
Subject: Re: pg_restore: error: schema "public" already exists
In-Reply-To: <1219519.1603852109@sss.pgh.pa.us>
References: <20201028014514.xel46ej4uy3bxdgs@raf.org> <1219519.1603852109@sss.pgh.pa.us>
* 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