best way to check pgdump

Started by Janet Jacobsenalmost 16 years ago3 messagesgeneral
Jump to latest
#1Janet Jacobsen
jsjacobsen@lbl.gov

Hi. What is the best way to check a pgdump
without doing a restore?

Thanks,
Janet

In reply to: Janet Jacobsen (#1)
Re: best way to check pgdump

On 23/06/2010 04:52, Janet Jacobsen wrote:

Hi. What is the best way to check a pgdump
without doing a restore?

If you used one of the binary formats for pg_dump, you can have
pg_restore list the contents without actually restoring the database.

If you did a text dump, just look into the file. :-)

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Raymond O'Donnell (#2)
Re: best way to check pgdump

On Wednesday 23 June 2010 4:12:40 am Raymond O'Donnell wrote:

On 23/06/2010 04:52, Janet Jacobsen wrote:

Hi. What is the best way to check a pgdump
without doing a restore?

If you used one of the binary formats for pg_dump, you can have
pg_restore list the contents without actually restoring the database.

http://www.postgresql.org/docs/8.3/interactive/app-pgrestore.html

To add, pg_restore has an -f switch that allows you to restore a binary dump to
a file. To quote from above:

"pg_restore can operate in two modes. If a database name is specified, the
archive is restored directly into the database. Otherwise, a script containing
the SQL commands necessary to rebuild the database is created and written to a
file or standard output. The script output is equivalent to the plain text
output format of pg_dump. Some of the options controlling the output are
therefore analogous to pg_dump options. "

This is quite handy as allows you store dumps in the compressed binary format
and retrieve specific information as needed in a human readable form.

If you did a text dump, just look into the file. :-)

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

--
Adrian Klaver
adrian.klaver@gmail.com