PostgreSQL: database restore from dump - syntax error

前端 未结 2 2012
后悔当初
后悔当初 2021-01-30 17:39

I\'m trying to restore a PostgreSQL database by executing the SQL that pg_dump created, on an empty database.

I\'m getting this error:

ERROR:  syntax er         


        
相关标签:
2条回答
  • 2021-01-30 18:15

    The -f filename argument on psql will read in the file, so you don't have to pipe it in. psql should be included in PostgreSQL's bin directory in windows. Like so:

    psql -d dbname -U username -f dumpfile.sql
    

    You may have to include a full path to the psql executable if it is not on your path, and possible add ".exe" to psql, so it is "psql.exe".

    Also make sure you are not going down in version numbers, I've run into syntax issues before (e.g don't export an 8.4 database and try to load it into an 8.1 database). If so, you may have to manually edit the dump file.

    0 讨论(0)
  • 2021-01-30 18:26

    try with psql -d dbname -U user -f dumpfile.sql

    0 讨论(0)
提交回复
热议问题