Thread: pg_restore does not restore

pg_restore does not restore

From
ruben
Date:
Hi:

I'm trying to dump tableA and restore it to tableB:

$ ./pg_dump -Fc -t tableA databaseA -f tableA.dump -v
$ ./pg_restore -t tableB -d databaseA tableA.dump -v

pg_dump creates tableA.dump aparently well, but after running pg_restore
without errors I cannot find any "tableB", what am I doing wrong?

I upgraded postgres version recently, the postmaster is running on port
5433, and pg_dump and pg_restore are now under /usr/local/pgsql/bin.

These are the outputs of the commands with -v (verbose):

$ ./pg_dump -Fc -t tableA databaseA -f tableA.dump -v
pg_dump: saving encoding
pg_dump: saving database definition
pg_dump: reading schemas
pg_dump: reading user-defined types
pg_dump: reading user-defined functions
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined tables
pg_dump: reading table inheritance information
pg_dump: finding inheritance relationships
pg_dump: reading column info for interesting tables
pg_dump: finding the columns and types of table "tableA"
pg_dump: finding default expressions of table "tableA"
pg_dump: flagging inherited columns in subtables
pg_dump: dumping out database comment
pg_dump: dumping out user-defined schemas
pg_dump: dumping out user-defined types
pg_dump: dumping out tables
pg_dump: dumping out indexes
pg_dump: dumping out user-defined procedural languages
pg_dump: dumping out user-defined functions
pg_dump: dumping out user-defined aggregate functions
pg_dump: dumping out user-defined operators
pg_dump: dumping out user-defined operator classes
pg_dump: dumping out user-defined casts
pg_dump: preparing to dump the contents of table tableA
pg_dump: dumping out rules
pg_dump: dumping contents of table tableA

$ ./pg_restore -t tableA_borrar -d databaseA tableA.dump -v
pg_restore: connecting to database for restore
pg_restore: implied data-only restore


Thanks.



Re: pg_restore does not restore

From
Tom Lane
Date:
ruben <ruben20@superguai.com> writes:
> I'm trying to dump tableA and restore it to tableB:

pg_dump does not do that.  The -t switch is for selecting one table
among several, not for renaming anything.

            regards, tom lane