Postgresql – Cannot restore postgres dump file

dumppostgresqlrestore

When i try to restore a database from a dump file using the following command:

 \i C:/pathname/dumpfile.txt

from within my sql shell, it runs the first few lines of the dump file and then I get the following error:

ERROR: permission denied to create "pg_catalog.databasename"
DETAIL: System catalog modifications are currently disallowed.

This shows the beginning of the dump file. I think the CREATE TABLE command triggers the error.

enter image description here

I'm using postgreSQL Version 11.1.
Any ideas how to solve this?

Best Answer

Ok I solved it: in the following line:

SET search_path = car, pg_catalog;

apparantly, car is the name of the schema. As that schema didn't exist, it tried to create a table in the pg_catalog schema. I manually created a schema called car, and, tada.. Thanks to everybody for their support.