takeshin takeshin - 1 month ago 4x
SQL Question

Purge postgresql database as it was new

I have created a PostgreSQL database dump using


Now I want to restore this backup from the file:

psql -d thesamename -f /my/backup/file

But I get errors that the data already exists.

Is there any command to delete everything from the database to bring it to just created state, except dropping and creating once again?

(I don't want to set up owner, tablescpace etc. once again)

Maybe some way to overwrite the database with the one from the backup file? (the backup file is from another database server)