Thread: Can a pg_dump file be loaded into a different OS?

Can a pg_dump file be loaded into a different OS?

From
"Anye M. Sellers"
Date:
I've got a client that has Postgres running on Linux
but my own development environment is on Windows.  Is
it feasible for me to have him do a pg_dump through
the pgAdmin tool and then for me to restore that file,
or are  the files formatted differently in both OS's?

If this doesn't work, can someone please recommend a
good way to migrate this data?

Thanks,
Anye

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Re: Can a pg_dump file be loaded into a different OS?

From
Michael Fuhr
Date:
On Tue, Aug 30, 2005 at 09:12:06AM -0700, Anye M. Sellers wrote:
> I've got a client that has Postgres running on Linux
> but my own development environment is on Windows.  Is
> it feasible for me to have him do a pg_dump through
> the pgAdmin tool and then for me to restore that file,
> or are  the files formatted differently in both OS's?

See the documentation for pg_dump:

http://www.postgresql.org/docs/8.0/static/app-pgdump.html

"Dumps can be output in script or archive file formats.  Script
dumps are plain-text files....  Script files can be used to reconstruct
the database even on other machines and other architectures...."

"The archive files are also designed to be portable across
architectures."

--
Michael Fuhr

Re: Can a pg_dump file be loaded into a different OS?

From
Michael Fuhr
Date:
[Please copy the mailing list on replies so others can participate
in and learn from the discussion.]

On Tue, Sep 06, 2005 at 08:04:31AM -0700, Anye M. Sellers wrote:
> I actually meant the custom archive format.  One of
> the tables in the client's database has so many
> records that it crashes creating a script file for it,
> at the exact same place every time - so they created
> used the -Fc extention on the pg_dump command.

What crashes?  pg_dump or the backend?  What (if any) error messages
do you see on the command line and in the server's logs?  If you
can reproduce that problem consistently then please report it as a
possible bug, because it shouldn't happen.

Regarding the custom archive format, the documentation says it
should work across platforms, and it has worked for me when I've
done it (going between FreeBSD/i386 and Solaris/sparc), at least
with PostgreSQL 8.0.3.

> When I try to load it I get an error saying the
> archive file is missing the "magic" line in the
> header.  I wasn't sure if that was a Linux vs. Windows
> issue or if the archive file was corrupt.

That sounds like a corrupt file.  What were the exact commands you
used to dump and restore the file, and what was the exact error
message?  What version of PostgreSQL are you using?  Are you using
the same version on both systems?  How did you transfer the file
from one system to the other?  Did you do a binary transfer?  I
don't know that a non-binary transfer would corrupt the magic header,
but it would probably corrupt other data in the file.

--
Michael Fuhr