What's the best way to backup a postgresql database?
I've tried using the documentation at www.postgresql.org, but I always get integrity errors when restoring.
Right now I'm using this for backup:
pg_dump -U myuser -d mydatabase db.pg.dump
for restore:
pg_restore -c -r -U myuser -d mydatabase db.pg.dump
But I'm not getting the desired results..
Edit: I should note, my db has a lot of foreign keys..
Some of the errors I see are:
ERROR: current transaction is aborted, commands ignored until end of transaction block
ERROR: zero-length delimited identifier at or near """"
LINE 1: ..._text_id_fkey" FOREIGN KEY ("text_id") REFERENCES ""."wiki_t...
Best Answer
from the pg_restore man page:
from the pg_dump man page:
You are not telling it to dump in a non plain-text format. You are telling it to restore a non plain-text format. obviously this is not going to work.
From the pg_dump man page: