Restore Database from dump.sql

498 views Asked by At

I am getting this error while restoring data from the dump file.

nishant@nishant-Lenovo-G50-70:~/Documents$ psql sortation_gor1 < dump.sql
psql: FATAL:  role "nishant" does not exist

I have followed the Postgress Ubuntu Documentation But when I am trying to restore the database I am getting this error. Any IDea. ?

2

There are 2 answers

0
Nishant Kashyap On

The I did it with the psql -U postgres -d d1atabase_name -f dump.sql

6
Pavel Stehule On

PostgreSQL pg_dump doesn't save a roles. Roles in PostgreSQL are related to database cluster, not to single database. It does pg_dumpall with option -r. You should to create missing roles manually with SQL statement CREATE ROLE name LOGIN or you have to use export roles with pg_dump -r.