pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: michael@sqlexec.com <michael@sqlexec.com>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: pgdude@pgdude.com, PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13804: pg_restore returns unexpected error
Date: Fri, 11 Dec 2015 16:52:56 -0500
Message-ID: <566B45B8.4080702@sqlexec.com> (raw)
In-Reply-To: <CAMkU=1xE4ojB693J4PCxhQvB4Aua7vbT7M3M6OhLPTc5QZjiMg@mail.gmail.com>
References: <20151207163520.2628.95990@wrigleys.postgresql.org>
	<CAB7nPqT-MyX1=TzqJ9WEiWwfKyr5b7qHiCvAnyOB5UkNUy7ESg@mail.gmail.com>
	<CAMkU=1xE4ojB693J4PCxhQvB4Aua7vbT7M3M6OhLPTc5QZjiMg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>


Example Test Case:

psql
create database aaa;
\c aaa
create table t1(akey int);
insert into t1 VALUES(1);
\q

-- example generates exit code 1 for pg_restore when creating public schema
pg_dump    -d aaa      -p 6432 -C -c --if-exists -Fc -v -w -f  ./db.dump
pg_restore -d postgres -p 6432 -C -c --if-exists -Fc -v        ./db.dump

-- generate listing
pg_restore -C -c --if-exists -Fc -v -l db.dump > db.list

-- generate output commands (no db provided)
pg_restore -C -c --if-exists -Fc -v -L db.list db.dump

-- execute using the list: generates same exit code 1 when attempting to 
create public schema
pg_restore -C -c --if-exists -Fc -v -L db.list db.dump -d postgres

> Jeff Janes <mailto:jeff.janes@gmail.com>
> Monday, December 7, 2015 7:33 PM
> On Mon, Dec 7, 2015 at 4:06 PM, Michael Paquier
>
>
> createdb foobar
> pgbench -i foobar
> pg_dump foobar -Fc > dump.dmp
> dropdb foobar
> pg_restore -C -c --if-exists -d postgres dump.dmp
>
> The above yields this message:
> ========
>
> ERROR: schema "public" already exists
> STATEMENT: CREATE SCHEMA public;
>
>
>
> pg_restore: [archiver (db)] Error while PROCESSING TOC:
> pg_restore: [archiver (db)] Error from TOC entry 5; 2615 2200 SCHEMA
> public jjanes
> pg_restore: [archiver (db)] could not execute query: ERROR: schema
> "public" already exists
> Command was: CREATE SCHEMA public;
>
>
> =======
>
> Since both -C and -c are specified, it should know that it is starting
> out with a freshly created database which has a public schema by
> default. So either it should not attempt to create the public schema
> a second time, or it should silently discard the (expected) error
> message, or conditionally drop the schema before recreating it.
>
> The error message does not indicate an actual problem, and can be
> ignored. But since the point of -c and --if-exists seems to be to
> suppress just that kind of ignorable error message, it does seem like
> a bug that it fails to do so.
>
> Cheers,
>
> Jeff
> Michael Paquier <mailto:michael.paquier@gmail.com>
> Monday, December 7, 2015 7:06 PM
>
>
>
> If you think this is a bug, could you send a test case? There is not 
> enough information regarding what you expect of pg_restore and what it 
> is currently doing.
> -- 
> Michael

view thread (6+ messages)  latest in thread

Message-ID: <566B45B8.4080702@sqlexec.com>
Permalink:  ../566B45B8.4080702@sqlexec.com/
Also on:    postgresql.org/message-id/566B45B8.4080702@sqlexec.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-bugs@postgresql.org
  Cc: michael@sqlexec.com, jeff.janes@gmail.com, michael.paquier@gmail.com
  Subject: Re: BUG #13804: pg_restore returns unexpected error
  In-Reply-To: <566B45B8.4080702@sqlexec.com>
  References: <20151207163520.2628.95990@wrigleys.postgresql.org> <CAB7nPqT-MyX1=TzqJ9WEiWwfKyr5b7qHiCvAnyOB5UkNUy7ESg@mail.gmail.com> <CAMkU=1xE4ojB693J4PCxhQvB4Aua7vbT7M3M6OhLPTc5QZjiMg@mail.gmail.com> <566B45B8.4080702@sqlexec.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