Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres 9.3 Backup and Restore Error

Tags:

postgresql

Fine i have taken backup of my database using "pg_dump" utility(dump file name is "testbackup.sql").Before restoring it back,i dropped all tables,view,sequences,functions which i have created. After that using "psql" command try to restore the dump back.But it shows the duplicate-key violation error. **

Error : psql.bin:testbackup.sql:17884: ERROR: duplicate key value violates unique constraint "pg_largeobject_metadata_oid_index".

**I googled in internet but i cant come to a correct solution.so Kindly provide us theproper solution.

like image 571
Rajkumar Avatar asked Oct 20 '25 11:10

Rajkumar


1 Answers

It seems you forgot to drop all large objects. List their IDs by checking in pg_largeobject and delete them using lo_unlink.

like image 116
Milen A. Radev Avatar answered Oct 22 '25 23:10

Milen A. Radev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!