Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I keep getting this pg_restore: [archiver] did not find magic string in file header when i execute a pg_restore -Fc -U "username" -d "dbname" "filename".dmpon my staging DB.

These DB are running on two separate AWS instances with windows server 2008 for both environments(staging and distribution). The postgres version used on distribution is the 9.2 and the version on staging is 9.3.

I think this issue could be related to the fact that i get several pg_dump: [custom archiver] WARNING: ftell mismatch with expected position -- ftell used warnings when i execute a pg_dump -Fc -U "username" -w "dbname" > "filename".dmp on the distribution DB.

Any help is appreciated.

share|improve this question

migrated from stackoverflow.com Feb 28 at 23:09

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 3 down vote accepted

I found several bug reports indicating that pg_dump has problems writing to a pipe on Windows:

Instead of writing to stdout and redirecting to a file, try using -f specify the output file:

pg_dump -Fc -U "username" -w "dbname" -f "filename".dmp
share|improve this answer
    
Thanks for the references of similar problems! I managed to get the dump to work, and restore it on staging. However, i am still getting lots of errors(like pg_restore: [archiver (db)] could not execute query: ERROR: function "functionname" already exists with same argument types) on the restore. Also, things still don't seem to work perfectly when i test my requests that were previously working in staging... any idea? –  xicocaio Jan 23 at 16:38
    
@xicocaio Thats really a different problem. SO works better if you submit each question separately, it helps others find the answers. Submit it as a new question and I'll gladly answer it! And also please accept this answer if it was correct, again it helps others find the answer. –  harmic Jan 23 at 20:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.