Basically, I'm trying to make a SQL dump that will make an exact copy of a database: user defined functions, relationships, constraints, tables, data, etc.
Is this doable with pg_dump
or does psql
need to be used instead?
I've been using pg_dump -U user -cOx database > pg.sql
, but it isn't entirely clear to me if it captures everything.
I was looking at all of the pg_dump
flags here:
https://www.postgresql.org/docs/11/app-pgdump.html
The only one I can think that might do it, because it doesn't really say explicitly, is the -s --schema-only
flag, which excludes data. I'm fine with that and running a second pg_dump
for the data, but I primarily want to make sure I am backing up the user defined functions, relationships, etc.