Re: pg_restore: error: schema "public" already exists

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: raf <raf(at)raf(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_restore: error: schema "public" already exists
Date: 2020-10-28 02:28:29
Message-ID: 1219519.1603852109@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

raf <raf(at)raf(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mahesh Bodepati 2020-10-28 04:57:12 Re: facing problem in outparameters in c
Previous Message raf 2020-10-28 01:45:14 pg_restore: error: schema "public" already exists