pg_dump

Started by Judith Altamirano Figueroaover 20 years ago2 messagesdocs
Jump to latest
#1Judith Altamirano Figueroa
jaltamirano@correolux.com.mx

Hi

how could I restore a db if I did next:

pg_dump -Z 9 soi > $DESTINO/soi.bkp

Thanks in advanced

#2Oliver Elphick
olly@lfix.co.uk
In reply to: Judith Altamirano Figueroa (#1)
Re: [SQL] pg_dump

On Fri, 2005-11-11 at 17:04 -0600, Judith Altamirano Figueroa wrote:

Hi

how could I restore a db if I did next:

pg_dump -Z 9 soi > $DESTINO/soi.bkp

Since you don't specify any dump format, your dump should be plain text
and is compressed with gzip, so the restore command is going to be:

zcat $DESTINO/soi.bkp | psql -d restore_database_name -f -

You have to create the database to restore into first.

------------------------------------------

[Note for documentation:
According to the psql man page:
-Z 0..9

--compress=0..9
Specify the compression level to use in archive formats that
support compression. (Currently only the custom archive format
supports compression.)

However using psql -Z with no format or with "-F p" in fact produces a
gzipped file.]

This might be a suitable amendment to the docs?:
$ diff -u /tmp/pg_dump.sgml.orig /tmp/pg_dump.sgml
--- /tmp/pg_dump.sgml.orig      2005-11-15 11:50:55.000000000 +0000
+++ /tmp/pg_dump.sgml   2005-11-15 11:57:38.000000000 +0000
@@ -492,8 +492,9 @@
       <listitem>
        <para>
         Specify the compression level to use in archive formats that
-        support compression.  (Currently only the custom archive
-        format supports compression.)
+        support compression.  (Currently the tar archive
+        format does not support compression.  The plain text format is
+        compressed with gzip.)
        </para>
       </listitem>
      </varlistentry>

--
Oliver Elphick olly@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
Do you want to know God? http://www.lfix.co.uk/knowing_god.html