Home > Enterprise >  How to restore backup postgres database on windows machine
How to restore backup postgres database on windows machine

Time:12-05

I have tried on terminal:

psql -d test < .\backup_database.sql
At line:1 char:14
  psql -d test < .\backup_database.sql
               ~
The '<' operator is reserved for future use.
      CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
      FullyQualifiedErrorId : RedirectionNotSupported

pg_dump command worked seamlessly on terminal. So where do i run psql command. Tried on dbshell-Not working, Manually adding on pgadmin 4 gives pg_restore: error: input file appears to be a text format dump. Please use psql.

CodePudding user response:

Don't use redirection on Windows, use the -f parameter to pass the file to be run:

psql -d test -f backup_database.sql
  • Related