Re: Help with pg_restore - Mailing list pgsql-admin

From Tom Lane
Subject Re: Help with pg_restore
Date
Msg-id 6219.1061475097@sss.pgh.pa.us
Whole thread Raw
In response to Help with pg_restore  ("dan" <dan@webfolks.us>)
List pgsql-admin
"dan" <dan@webfolks.us> writes:
> I created the data directory, then ran initdb to do the intial setup. I next
> ran:
> cat file1 file2 file3 | pg_restore --clean --create
> It churned for a while and generated a lot of output (file1 and file 2 are
> just over a gigabyte each, and file3 is about 300 MB). But when I ran psql,
> none of the tables had been created. What am I doing wrong?

After some digging in the CVS logs, I came across this post-7.1 fix:

2001-10-23 17:26  tgl

    * src/bin/pg_dump/pg_backup_archiver.c: Forbid the switch
    combination --clean --create, which is pointless (why bother
    dropping individual objects in a just-created database?) as well as
    dangerous (as the code stands, the drops will be issued in the
    wrong database, namely the one you were originally connected to).

which might or might not explain your difficulty.  What I'm currently
suspecting is that pg_restore did restore, but not into the database you
expected it to (I think it would have created a new database of the
original DB name, and restored into that).

            regards, tom lane

pgsql-admin by date:

Previous
From: "mathan"
Date:
Subject: Re: Starting PostgreSQL 7.3.4 with Webmin on Mandrake 9.1
Next
From: Tom Lane
Date:
Subject: Re: pg_dump does not dump index, constraints, sequences