pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: iann@fuelforce.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7507: pg_restore silently fails when restoring a db with the --create flag and no user.
Date: Mon, 27 Aug 2012 15:31:08 -0400
Message-ID: <7536.1346095868@sss.pgh.pa.us> (raw)
In-Reply-To: <E1T61KM-0005nD-Qc@wrigleys.postgresql.org>
References: <E1T61KM-0005nD-Qc@wrigleys.postgresql.org>

iann@fuelforce.com writes:
> Attempting to restore a db using pg_restore to a new database server using
> the --create and --dbname flags fails silently if the db owner username does
> not exist in the new db or the -O flag is not used.
> Command used:
> pg_restore --create --verbose --dbname=testserver
> /Volumes/USBLINKS1/hostname.testserver.net_postgres_database 

It'll fail, yes, because pg_dump by itself doesn't dump CREATE USER
commands (since users are external to any individual database).
However, it hardly seems "silent" to me.  I see complaints like these:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1851; 1262 116736 DATABASE mydb dbowner
pg_restore: [archiver (db)] could not execute query: ERROR:  role "dbowner" does not exist
    Command was: ALTER DATABASE mydb OWNER TO dbowner;

pg_restore: [archiver (db)] Error from TOC entry 161; 1259 116737 TABLE mytable dbowner
pg_restore: [archiver (db)] could not execute query: ERROR:  role "dbowner" does not exist
    Command was: ALTER TABLE public.mytable OWNER TO dbowner;

WARNING: errors ignored on restore: 2

Possibly you want to use the --exit-on-error option?

			regards, tom lane




view thread (3+ messages)  latest in thread

Message-ID: <7536.1346095868@sss.pgh.pa.us>
Permalink:  ../7536.1346095868@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7536.1346095868@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, iann@fuelforce.com
  Subject: Re: BUG #7507: pg_restore silently fails when restoring a db with the --create flag and no user.
  In-Reply-To: <7536.1346095868@sss.pgh.pa.us>
  References: <E1T61KM-0005nD-Qc@wrigleys.postgresql.org> <7536.1346095868@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