yerassyl
yerassyl

Reputation: 3048

Restore database from pg_dump syntax errors

all I am trying to restore my db from pg_dump that I got from my server. I know there are plenty similar question, I tried what was suggested but still can not resolve my issue. I created my pg_dump via this command:

pg_dump name_of_database > name_of_backup_file

Then I create new db:

createdb -T template0 restored_database

Then I restore using this command:

psql -1 -f name_of_backup_file.sql restored_database

It runs and then I got different syntax errors, for example:

psql:nurate_pg_dump.sql:505: invalid command \nWatch
Query buffer reset (cleared).
psql:nurate_pg_dump.sql:512: invalid command \nThe
psql:nurate_pg_dump.sql:513: invalid command \N
psql:nurate_pg_dump.sql:4098: ERROR:  syntax error at or near "9"
LINE 1: 9 the course is not difficult, but Zauresh Atakhanova is not...

I believe since I made pg_dump from the same server, and try to restore it there nothing changed in my server setup, or version of postgres, so I think my db should restore correctly. How can I resolve these syntax errors?

EDIT: Ok, the problem is not with the syntax:

CREATE EXTENSION
ERROR: must be owner of extension plpgsql

This error is thrown at this line:

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;

Upvotes: 2

Views: 3229

Answers (1)

cur4so
cur4so

Reputation: 1820

try to restore your database with

psql restored_database < name_of_backup_file

Upvotes: 4

Related Questions