0

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?

6
  • Have you created an empty schema for your data? Maybe you could try that?
    – Vérace
    Jan 5, 2019 at 15:38
  • But then how do I restore the dump into this empty schema?
    – user169425
    Jan 5, 2019 at 17:54
  • Do you still have access to the old database? if so, redo the dump using the pg_dump from 11.1, not from 9.6.0.
    – jjanes
    Jan 5, 2019 at 18:13
  • Unless you changed the setting of "log_min_error_statement", you shouldn't have to guess what statement triggered the ERROR. The ERROR message will include the triggering statement. Using the default log format, it will be flagged with "STATEMENT:"
    – jjanes
    Jan 5, 2019 at 18:23
  • I don't have access to the old database so I can't redo the dump. I tried to restore it using Version 9.6.0 though, but that didn't work either.
    – user169425
    Jan 6, 2019 at 8:31

2 Answers 2

1

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.

0

First check if you need to set the search_path (see the other answer to the question).

SET search_path = car, pg_catalog;

Then check if the schema exists. If not, then add this to your SQL dump file:

CREATE SCHEMA car;
ALTER SCHEMA car OWNER TO car;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.