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?



2014-03-27 20:30 GMT+01:00 Federico Bruni <[email protected]>:

> 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.)
>
>
>
>
> 2014-03-27 18:15 GMT+01:00 Neum Schmickrath <[email protected]>:
>
> 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
>>
>>
>>
>> On Monday, March 24, 2014 2:28:41 AM UTC-6, Federico Bruni wrote:
>>>
>>> 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
>>>
>>  --
>> 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
>> [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to