Marius Schuller
5 years
Marius Schuller
5 years
Henning Koch
10 years
Andreas Herz
6 years
Claus-Theodor Riegg
6 years
Claus-Theodor Riegg
7 years
Claus-Theodor Riegg
7 years
Claus-Theodor Riegg
7 years
Claus-Theodor Riegg
7 years
Claus-Theodor Riegg
8 years
Marius Schuller
8 years
Claus-Theodor Riegg
8 years

convert PostgreSQL custom dump format to textdump

Updated . Posted . Visible to the public.

If you have a PostgreSQL dump in the custom format you can can view the text format dump (plain SQL statements).

PostgreSQL 12 and newer

Write it as a textdump to a file:

pg_restore $dumpname -f name.textdump

Applying parameters

You can apply the same parameters for the output of the textdump as for restoring the dump (for e.g. --clean to drop database objects before recreating them):

pg_restore --clean $dumpname -f $name.textdump

PostgreSQL 11 and older

You can output the contents to STDOUT and redirect it to a file:

pg_restore $dumpname > $name.textdump
Claus-Theodor Riegg
Last edit
Claus-Theodor Riegg
Keywords
pg_dump
License
Source code in this card is licensed under the MIT License.