pg_restore -n sch1 : schema "sch1" does not exist

From: lin <jluwln(at)163(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: pg_restore -n sch1 : schema "sch1" does not exist
Date: 2014-12-09 15:29:14
Message-ID: 300758f9.c63c.14a2fab2bfa.Coremail.jluwln@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,all:
I create a schema (sch1) in the database of db1, and I also create a table sch1.t1, then I use the comand "pg_dump -d db1 -Fd -f dir1" to back up the database of db1; at lase I drop the schema of sch1; I want to restore the schema sch1, but when I execute the command "pg_restore -d db1 -Fd dir1 -n sch1", get error, just like below.
I just want to test the parameter of "-n" for pg_restore, how can do to use the pg_restore correctly?

[wln(at)localhost test]$ pg_restore -d db1 -Fd dir1 -n sch1
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 171; 1259 24669 TABLE t1 wln
pg_restore: [archiver (db)] could not execute query: ERROR: permission denied to create "pg_catalog.t1"
DETAIL: System catalog modifications are currently disallowed.
Command was: CREATE TABLE t1 (
id integer
);

pg_restore: [archiver (db)] could not execute query: ERROR: schema "sch1" does not exist
Command was: ALTER TABLE sch1.t1 OWNER TO wln;

pg_restore: [archiver (db)] Error from TOC entry 2777; 0 24669 TABLE DATA t1 wln
pg_restore: [archiver (db)] could not execute query: ERROR: relation "t1" does not exist
Command was: COPY t1 (id) FROM stdin;

WARNING: errors ignored on restore: 3

[wln(at)localhost test]$ pg_restore -d db1 -Fd dir1 -n sch1 -l
;
; Archive created at Fri Sep 26 10:26:43 2014
; dbname: db1
; TOC Entries: 11
; Compression: -1
; Dump Version: 1.12-0
; Format: DIRECTORY
; Integer: 4 bytes
; Offset: 8 bytes
; Dumped from database version: 9.3beta2
; Dumped by pg_dump version: 9.3beta2
;
;
; Selected TOC Entries:
;
171; 1259 24669 TABLE sch1 t1 wln
2777; 0 24669 TABLE DATA sch1 t1 wln

Thanks,
wanglin

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-12-09 15:54:01 Re: pg_restore -n sch1 : schema "sch1" does not exist
Previous Message Daniel Begin 2014-12-09 14:58:18 Re: Removing duplicate records from a bulk upload (rationale behind selecting a method)