pg_restore: show object schema name in verbose output - Mailing list pgsql-hackers

From Ian Lawrence Barwick
Subject pg_restore: show object schema name in verbose output
Date
Msg-id CAB8KJ=iKZud+icOGkiSCJ+t9A1TACLYhxXugwWtRif_xryTfSQ@mail.gmail.com
Whole thread Raw
Responses Re: pg_restore: show object schema name in verbose output  ("Erik Rijkers" <er@xs4all.nl>)
List 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

pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Need help to begin contribution in PostgreSQL Development - Specifically XML module
Next
From: "Erik Rijkers"
Date:
Subject: Re: pg_restore: show object schema name in verbose output