pg_restore error

91 views
Skip to first unread message

Federico Bruni

unread,
Mar 24, 2014, 4:28:41 AM3/24/14
to mezzani...@googlegroups.com
I've made the dump of the local database and I've tried to restore it on the server, but I'm getting the error below.
BTW, how can I force the output to be in english? I've tried LANG=C but didn't work. Should I change the locale on the server?

Any help appreciated.

_restore: [archiviatore (db)] Errore nella voce TOC 2142; 2606 26962 FK CONSTRAINT to_blogpost_id_refs_id_6404941b fede
pg_restore: [archiviatore (db)] could not execute query: ERRORE:  il vincolo "to_blogpost_id_refs_id_6404941b" per la relazione "blog_blogpost_related_posts" esiste già
    Command was: ALTER TABLE ONLY blog_blogpost_related_posts
    ADD CONSTRAINT to_blogpost_id_refs_id_6404941b FOREIGN KEY (to_blogpost_id)...
pg_restore: [archiviatore (db)] Errore nella voce TOC 2172; 2606 26967 FK CONSTRAINT twitter_tweet_query_id_fkey fede
pg_restore: [archiviatore (db)] could not execute query: ERRORE:  il vincolo "twitter_tweet_query_id_fkey" per la relazione "twitter_tweet" esiste già
    Command was: ALTER TABLE ONLY twitter_tweet
    ADD CONSTRAINT twitter_tweet_query_id_fkey FOREIGN KEY (query_id) REFERENCES twitter_quer...
pg_restore: [archiviatore (db)] Errore nella voce TOC 2133; 2606 26972 FK CONSTRAINT user_id_refs_id_40c41112 fede
pg_restore: [archiviatore (db)] could not execute query: ERRORE:  il vincolo "user_id_refs_id_40c41112" per la relazione "auth_user_groups" esiste già
    Command was: ALTER TABLE ONLY auth_user_groups
    ADD CONSTRAINT user_id_refs_id_40c41112 FOREIGN KEY (user_id) REFERENCES auth_user(id)...
pg_restore: [archiviatore (db)] Errore nella voce TOC 2135; 2606 26977 FK CONSTRAINT user_id_refs_id_4dc23c39 fede
pg_restore: [archiviatore (db)] could not execute query: ERRORE:  il vincolo "user_id_refs_id_4dc23c39" per la relazione "auth_user_user_permissions" esiste già
    Command was: ALTER TABLE ONLY auth_user_user_permissions
    ADD CONSTRAINT user_id_refs_id_4dc23c39 FOREIGN KEY (user_id) REFERENCES aut...
ATTENZIONE: errore ignorato durante il ripristino: 219

Neum Schmickrath

unread,
Mar 27, 2014, 1:15:19 PM3/27/14
to mezzani...@googlegroups.com
What are the pg_ commands you are using? These are the commands I use to dump and then restore and I've never had a problem.

pg_dump -U USERNAME -F t -f NAMEOF.backup DATABASE-NAME 

pg_restore -d DATABASE-NAME -O -U USERNAME NAMEOF.backup

Federico Bruni

unread,
Mar 27, 2014, 3:30:05 PM3/27/14
to mezzani...@googlegroups.com
I've resolved following the suggestion of Ken in this thread: using the commands present in fabfile.py, that is:

pg_dump -Fc DATABASE > FILE
pg_restore -c -d DATABASE FILE

Though I can't remember exactly what I used before.. probably I didn't use the -c  option in pg_restore:

-c, --clean
           Clean (drop) database objects before recreating them. (This might
           generate some harmless error messages, if any objects were not present
           in the destination database.)




--
You received this message because you are subscribed to a topic in the Google Groups "Mezzanine Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mezzanine-users/otAYtS2qLuE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Federico Bruni

unread,
Jun 10, 2014, 12:53:02 PM6/10/14
to mezzani...@googlegroups.com
I've just had this same problem and the command above didn't work at first.
It worked when I switched the local to english:

export LANG=C

pg_restore -c -d DATABASE FILE

Maybe it's just a coincidence?

Reply all
Reply to author
Forward
0 new messages