1

I'm currently trying to restore a database using PostgreSQL. The database has up to 500 tables, and some triggers, functions and views too.

I create my .backup file using this command line:

pg_dump.exe --host localhost --port 5432 --username postgres --format tar --file c:\gestorteste.backup Gestor

And then I try to restore a copy of the original database using:

pg_restore.exe --host localhost --port 5432 --username postgres --dbname Gestor_Copy c:\gestorteste.backup

The problem is that only rarely the Postgres (version 13) manages to restore the database sucessfully. Most of the time, It just won't restore the triggers attached to the database tables.

i've gone through the PostgreSQL documentation on it, and I found that it's possible to use a 'disable triggers' parameter in the pg_restore if you don't you wnat them to be restored, but since i'm not using it, it makes me even more confused about it

Does anybody know why this is happening or how to fix it?

alvherre
  • 2,499
  • 20
  • 22
  • I recommend you don't use `--format tar`. It's just not a very good format. Use `--format custom` instead. That probably doesn't explain your problem though. Maybe the pg_restore call is throwing errors that you're not seeing; did you try redirecting the error output to a file you can examine? I don't know about windows, but I think this should work: pg_restore --verbose [other options] 2> errors.txt then have a look at the errors.txt file and see if you missed anything important. – alvherre May 20 '21 at 20:12

0 Answers0