pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guillaume Lelarge <guillaume@lelarge.info>
To: Fábio Gibon - Comex System <gibon@comexsystem.com.br>
Cc: PostgreSQL - mailing list <pgsql-admin@postgresql.org>
Subject: Re: Validade dump file
Date: Tue, 05 Oct 2010 08:39:23 +0200
Message-ID: <4CAAC81B.7030205@lelarge.info> (raw)
In-Reply-To: <120c01cb643d$cb46ab60$aadd5bbb@gibon>
References: <120c01cb643d$cb46ab60$aadd5bbb@gibon>

Le 05/10/2010 05:28, Fábio Gibon - Comex System a écrit :
> [...]
> are there some tool or internal program that read a dump file (created by pg_dump) and list all tables and number of tuples (without 
> restore) in this file?
> 

That command should give you the number of tables in your plain dump:

  grep "CREATE TABLE" your_dump_file | wc -l

If you have a binary dump (ie, tar or custom), you should do this:

  pg_restore -s your_dump_file | grep "CREATE TABLE" | wc -l

There's no easy way to get the number of tuples in each table.

> And too, are there some tool to check the physical file integrity? (S.O. Windows)

notepad? :)

I mean, with a SQL file, this is just a bunch of SQL queries. So there's
no real way to check the file integrity without restoring it.

On a binary dump, you can do a "pg_restore your_dump_file > /dev/null".
It should warn you if you have an integrity issue.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com



view thread (4+ messages)  latest in thread

Message-ID: <4CAAC81B.7030205@lelarge.info>
Permalink:  ../4CAAC81B.7030205@lelarge.info/
Also on:    postgresql.org/message-id/4CAAC81B.7030205@lelarge.info

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: guillaume@lelarge.info, gibon@comexsystem.com.br
  Subject: Re: Validade dump file
  In-Reply-To: <4CAAC81B.7030205@lelarge.info>

* 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