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. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 Feb 28 '14 at 23:09

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

up vote 6 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 '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 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 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.