pg_restore: show object schema name in verbose output

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_restore: show object schema name in verbose output
Date: 2013-08-04 02:51:41
Message-ID: CAB8KJ=iKZud+icOGkiSCJ+t9A1TACLYhxXugwWtRif_xryTfSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I just noticed that pg_restore executing in "verbose" mode displays the
name of the object being restored, but not its schema.

I'd like to be able to see the fully-qualified object name because
if pg_restore spits out a warning like this:

$ pg_restore -d somedb /path/to/dumpfile.pgd
pg_restore: WARNING: column "session_id" has type "unknown"
DETAIL: Proceeding with relation creation anyway.
$

verbose mode is useful to identify which object is at issue, e.g.:

$ pg_restore -v -d somedb /path/to/dumpfile.pgd
pg_restore: connecting to database for restore
(...)
pg_restore: creating VIEW someview
pg_restore: WARNING: column "session_id" has type "unknown"
DETAIL: Proceeding with relation creation anyway.
(...)
$

but only shows the bare object name. In the case I recently encountered,
objects with the same name existed in multiple schemas, which meant it
took longer to track down the offending object than it could have done.

The attached patch changes the output to print the schema name too, e.g.:

$ pg_restore -v -d somedb /path/to/dumpfile.pgd
pg_restore: connecting to database for restore
(...)
pg_restore: creating VIEW schema94.someview
pg_restore: WARNING: column "session_id" has type "unknown"
DETAIL: Proceeding with relation creation anyway.
(...)
$

which is more useful, IMHO.

Regards

Ian Barwick

Attachment Content-Type Size
pg-restore-verbose-output-schema-2013-08-03.patch application/octet-stream 985 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Erik Rijkers 2013-08-04 07:17:24 Re: pg_restore: show object schema name in verbose output
Previous Message Kevin Grittner 2013-08-03 18:06:15 Re: Need help to begin contribution in PostgreSQL Development - Specifically XML module