POSTGRESQL-DUMP(8)                             POSTGRESQL-DUMP(8)

       postgresql-dump  -  a  utility to dump and destroy a Post-
       greSQL database when the database format becomes incompat-
       ible with a previous version.

       /usr/lib/postgresql/bin/postgresql-dump   [-c]  [-d]  [-i]
       [-l] [-p directory] -t target_file [-u] [-v] [-x]

       postgreql-dump is used to dump and reload the whole  Post-
       greSQL  database  when  the  database  format  has changed
       between releases and become  incompatible.  It  tests  for
       this  situation  by  reading  the version file in the top-
       level directory of the PostgreSQL database.

       If there is an incompatibility between the  database  ver-
       sion  of  the  current PostgreSQL programs and that of the
       database itself, this program must be  used  to  dump  the
       database to an ASCII file. (This may be a tape device.)

       If  the  -d  option  is  used,  the entire contents of the
       database directory are then deleted.   They  may  be  pre-
       served  in  another  location,  should  you  have both the
       desire and the spare disk capacity.

       Postgresql-dump may only be run by the user postgres  (the
       postgresql superuser).

       -c     After  the dump has been written, copy it to screen
              through the filter named  in  PAGER  (or  more,  by
              default)  and  ask  the  user  to give confirmation
              before deleting the database files.

       -d     Destroy  the  database  files  after  dumping   the
              database.   This  option  must  be used when a new,
              incompatible  release  of  PostgreSQL  is   loaded,
              unless the -u option is used.

       -i     Create  a  new database with initdb.  This requires
              the option -d.

       -l     Load the dump into a  new  database.   This  option
              requires the -i option.

       -p directory
              This  option  can only be used with -d.  Instead of
              destroying the database files,  the  program  moves
              them  under  directory,  creating it, if necessary.
              Directory must not be the  same  directory  as,  or
              underneath  the  directory named in the environment
              variable, PGDATA.

       -t target
              This option is always required.  Target is the file
              or  tape to which the ASCII dump should be written.
              It is incorrect to name any physical  device  other
              than  a  tape.   It  is not possible (or, at least,
              meaningful) to use a tape with the  -c  option  and
              also  to  start the dump in the middle of the tape.
              Target must not be the same directory as, or under-
              neath  the directory named in the environment vari-
              able, PGDATA.

       -u     Use the pg_upgrade command to do the upgrade.  This
              involves  writing a dumpfile that contains only the
              database structure, but not the data  itself.   The
              old  database  files  are  moved to $PGDATA.old (if
              necessary) and the old data is read  from  them  to
              populate  the  tables  in the new database.  Use of
              this option forces -l, and cancels -d, even  if  it
              has been specified.  This option is recommended for
              upgrades from 6.3 and above.

       -v     Print more information about  what  the  script  is

       -x     Prevents  dumping  the  old  database;  use of this
              option forces -c.

       initdb, pg_dump, pg_dumpall, pg_upgrade

       The program does not check that a device is really a tape.
       If you send the dump to the screen, for instance, and also
       use  -d,  without  -c,  you  will  destroy  your  database

       The -u option cannot be used to upgrade from versions ear-
       lier than 6.5 to version 6.5 or later.  This is because of
       a  change  in  the  way  rows  are  stored in the database

       postgresql-dump was written for Debian GNU/Linux by Oliver
       Elphick  <>.  postgresql-dump was
       adapted to run on RedHat Linux for the RPM distribution by
       Lamar Owen <>