43 cards
View
Posted 10 months ago. Visible to the public.

convert PostgreSQL custom dump format to textdump

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

You can output the contents to STDOUT:

Copy
pg_restore $dumpname

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):

Copy
pg_restore --clean $dumpname

To write the textdump to a file just use I/O redirection or the -f parameter:

Copy
pg_restore $dumpname > textdump.sql pgrestore -f textdump.sql $dumpname

Owner of this card:

Avatar
Claus-Theodor Riegg
Last edit:
9 months ago
by Claus-Theodor Riegg
This website uses cookies to improve usability and analyze traffic.
Accept or learn more