Subject: pg_dump

From: Judith Altamirano Figueroa <[email-masked]>
Date: Fri, 11 Nov 2005 17:04:47 -0600

Hi

how could I restore a db if I did next:

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

Thanks in advanced

---

From: Oliver Elphick <[email-masked]>
Date: Tue, 15 Nov 2005 12:01:58 +0000

>     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                                          [email-masked]
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