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.


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
  • 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 '14 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 '14 at 20:46
  • I'm getting exactly the same thing, It hasn't been fixed years later. I'm restoring a dump file to postgres 9.4. RHEL Server pg_dump -> pipe to windows workstation -> CentOS pg_restore – Josue Alexander Ibarra Jul 24 '15 at 18:03
  • Those commands aren't working for me. My PostgreSQL version is 9.4 – mr5 Oct 31 '15 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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