Skip site navigation (1) Skip section navigation (2)

Re: [SQL] pg_dump

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Judith Altamirano Figueroa <jaltamirano(at)correolux(dot)com(dot)mx>
Cc: pgsql-docs(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] pg_dump
Date: 2005-11-15 12:01:58
Message-ID: 1132056118.10188.12.camel@linda.lfix.co.uk (view raw or flat)
Thread:
Lists: pgsql-docspgsql-sql
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(at)lfix(dot)co(dot)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


In response to

  • pg_dump at 2005-11-11 23:04:47 from Judith Altamirano Figueroa

pgsql-docs by date

Next:From: Bruce MomjianDate: 2005-11-15 14:04:04
Subject: Re: [DOCS] 8.1 PDF Documentation.
Previous:From: Peter EisentrautDate: 2005-11-15 11:54:49
Subject: Re: 8.1 PDF Documentation.

pgsql-sql by date

Next:From: Lane Van IngenDate: 2005-11-15 14:53:29
Subject: Re: How to Log SELECT Statements Having Errors
Previous:From: Magnus HaganderDate: 2005-11-15 08:52:58
Subject: Re: How to Log SELECT Statements Having Errors

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group