pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7507: pg_restore silently fails when restoring a db with the --create flag and no user.
3+ messages / 3 participants
[nested] [flat]

* BUG #7507: pg_restore silently fails when restoring a db with the --create flag and no user.
@ 2012-08-27 15:34  iann@fuelforce.com
  0 siblings, 2 replies; 3+ messages in thread

From: iann@fuelforce.com @ 2012-08-27 15:34 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      7507
Logged by:          Ian Nobile
Email address:      iann@fuelforce.com
PostgreSQL version: 9.1.4
Operating system:   Mac OS X Version 10.8
Description:        

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 





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #7507: pg_restore silently fails when restoring a db with the --create flag and no user.
@ 2012-08-27 19:31  Tom Lane <tgl@sss.pgh.pa.us>
  parent: iann@fuelforce.com
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2012-08-27 19:31 UTC (permalink / raw)
  To: iann@fuelforce.com; +Cc: pgsql-bugs

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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #7507: pg_restore silently fails when restoring a db with the --create flag and no user.
@ 2012-09-01 16:14  Bruce Momjian <bruce@momjian.us>
  parent: iann@fuelforce.com
  1 sibling, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2012-09-01 16:14 UTC (permalink / raw)
  To: iann@fuelforce.com; +Cc: pgsql-bugs

On Mon, Aug 27, 2012 at 03:34:10PM +0000, iann@fuelforce.com wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      7507
> Logged by:          Ian Nobile
> Email address:      iann@fuelforce.com
> PostgreSQL version: 9.1.4
> Operating system:   Mac OS X Version 10.8
> Description:        
> 
> 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 

Well, I tried this and it showed a proper error:

	$ pg_restore --create --verbose -U yy --dbname=testserver /rtmp/xx
	pg_restore: connecting to database for restore
	pg_restore: [archiver (db)] connection to database "testserver" failed: 
	FATAL:  role "yy" does not exist

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-09-01 16:14 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-08-27 15:34 BUG #7507: pg_restore silently fails when restoring a db with the --create flag and no user. iann@fuelforce.com
2012-08-27 19:31 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-09-01 16:14 ` Bruce Momjian <bruce@momjian.us>

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