Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pg_restore toc error

i was using the following syntax for pg_dump and restore

pg_dump eval --inserts -b -c --encoding UTF8 -Fc -f eval.sql.tar.gz -x -U postgres createdb -T template0 test -U postgres pg_restore -d test eval.sql.tar.gz -e -U postgres 

the dump was successfull with no errors, but restore makes a some errors, i am dumping and restoring in same machine with same user and privilege all...

i have tried out with other formats also, plain, tar, compressed all gets the same error..

my version of pg is 8.4.11 and psql version is 8.4.11

i am not sure what makes these errors.. can anyone help me

 pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 4965; 0 138871 TABLE DATA ir_act_report_xml insigni pg_restore: [archiver (db)] could not execute query: ERROR:  invalid input syntax for integer: "purchase.order" LINE 1: ...st for Quotation', 'ir.actions.report.xml', NULL, 'purchase....                                                              ^     Command was: INSERT INTO ir_act_report_xml VALUES (350, 'Request for Quotation', 'ir.actions.report.xml', NULL, 'purchase.order', 'purcha... 
like image 726
MAHI Avatar asked Mar 23 '12 09:03

MAHI


People also ask

What is Pg_restore in Postgres?

Description. pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats. It will issue the commands necessary to reconstruct the database to the state it was in at the time it was saved.

How long does a Pg_restore take?

During pg_restore , the database size is increasing at a rate of 50 MB/minute estimated using the SELECT pg_size_pretty(pg_database_size()) query. At this rate, it will take approximately 130 hours to complete the restore which is a very long time.

Where is Pg_restore?

pg_dump, pg_dump_all, pg_restore are all located in the bin folder of the PostgreSQL install and PgAdmin III install.

Does Pg_restore create database?

It will NOT create that database. It creates a database with the name from the archive you are restoring and restores the data into that database.

Can PG_restore restore data that is not in the archive file?

Obviously, pg_restore cannot restore information that is not present in the archive file. For instance, if the archive was made using the “dump data as INSERT commands” option, pg_restore will not be able to load the data using COPY statements.

What's wrong with--clean option in PG_restore?

The --clean option in pg_restore doesn't look like much but actually raises non-trivial problems. The combination of --create and --clean in pg_restore options used to be an error in older PG versions (up to 9.1).

What is the difference between-D and-C in PG_restore?

The database named in the -d switch can be any database existing in the cluster; pg_restore only uses it to issue the CREATE DATABASE command for mydb. With -C, data is always restored into the database name that appears in the dump file.

Why can’t PG_restore load the data using copy statements?

For instance, if the archive was made using the “dump data as INSERT commands” option, pg_restore will not be able to load the data using COPY statements. pg_restore accepts the following command line arguments.


2 Answers

this did the trick

pg_dump database_name -c -Ft -f file_name.tar   pg_restore -d database_name -c file_name.tar 

before this i was trying to restore with out including -c(clean)

even though -c is included in pg_dump it is not used in pg_restore unless we say to use...

like image 64
MAHI Avatar answered Sep 18 '22 10:09

MAHI


The solution in my case:

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U username -d database_name dump_name.dump 
like image 41
AkashP Avatar answered Sep 21 '22 10:09

AkashP