Обсуждение: cannot dump structures
Hello,
I have on db server Postgresql 8.2.5
pg_dump (data and structures) works well.
I have copied pg_dum file (and libpq.so.5) to other server, into chroot where is apache and phppgadmin. And there is
problem.Dump of structures doesnt work, onlydata OK.
I have wrote 2 minimalistic php scripts:
1] dump only data works:
<?
putenv('PGPASSWORD=password');
$cmd = '/var/pgsql/bin/pg_dump dbname -U dbuser -h hostname -a -i';
passthru($cmd);
?>
2] dump structures doesnt work
<?
putenv('PGPASSWORD=password');
$cmd = '/var/pgsql/bin/pg_dump dbname -U username -h hostname -s -i';
passthru($cmd);
?>
and in pg_log is message:
STATEMENT: SELECT (SELECT usename FROM pg_user WHERE usesysid = datdba) as dba, pg_encoding_to_char(encoding) as
encoding,datpath FROM pg_database WHERE datname = 'dbname'
ERROR: column "datpath" does not exist at character 113
I have search on google, mailing lists, forums...
I know that this message means that pg_dump is old version, but its impossible, the pg_dump binary file is from
dbserver.
DATABASE:
#/var/pgsql/bin/pg_dump --version
pg_dump (PostgreSQL) 8.2.5
WEBSERVER in CHROOT:
#chroot /usr/local/chroot/apache_phpPgAdmin /var/pgsql/bin/pg_dump --version
pg_dump (PostgreSQL) 8.2.5
linked with right library:
#chroot /usr/local/chroot/apache_phpPgAdmin /usr/local/ldd /var/pgsql/bin/pg_dump
libpq.so.5 => /var/pgsql/lib/libpq.so.5 (0xb7f3c000)
pg_dump on dbserver works.
same binary file on other server doesnt work.
How is it possible please?
Btw. old pg_dump for old postgresql(7.4.7) works well.
=?us-ascii?Q?Martin=20Korous?= <Mortals@seznam.cz> writes:
> and in pg_log is message:
> STATEMENT: SELECT (SELECT usename FROM pg_user WHERE usesysid = datdba) as dba, pg_encoding_to_char(encoding) as
encoding,datpath FROM pg_database WHERE datname = 'dbname'
> ERROR: column "datpath" does not exist at character 113
You're running a 7.something pg_dump against an 8.something server.
This will not work because that pg_dump doesn't know about 8.x
catalog layout.
My advice is never, never, never use the -i option to pg_dump.
It is generally only useful for shooting yourself in the foot,
as is happening here.
> I know that this message means that pg_dump is old version, but its impossible, the pg_dump binary file is from
dbserver.
You need to reconsider "impossible". Maybe your search path
isn't what you think it is.
regards, tom lane
< You're running a 7.something pg_dump against an 8.something server. < This will not work because that pg_dump doesn't know about 8.x < catalog layout. its standard answer for message `ERROR: column "datpath"....` but I wrote: DATABASE: #/var/pgsql/bin/pg_dump --version pg_dump (PostgreSQL) 8.2.5 and WEBSERVER in CHROOT: #chroot /usr/local/chroot/apache_phpPgAdmin /var/pgsql/bin/pg_dump --version pg_dump (PostgreSQL) 8.2.5 < My advice is never, never, never use the -i option to pg_dump. < It is generally only useful for shooting yourself in the foot, < as is happening here. dump only data is not good too, works only with -i < You need to reconsider "impossible". Maybe your search path < isn't what you think it is. I dont use search path, i wrote absolute path: $cmd = '/var/pgsql/bin/pg_dump dbname -U username -h hostname -s -i'; pg_dump out of chroot work in chroot doesnt work...mystery regards Martin Korous
=?us-ascii?Q?Martin=20Korous?= <Mortals@seznam.cz> writes:
> < You're running a 7.something pg_dump against an 8.something server.
> < This will not work because that pg_dump doesn't know about 8.x
> < catalog layout.
> its standard answer for message `ERROR: column "datpath"....`
> but I wrote:
> DATABASE:
> #/var/pgsql/bin/pg_dump --version
> pg_dump (PostgreSQL) 8.2.5
A look at the source code is sufficient to prove that the string
"datpath" occurs nowhere in 8.2 pg_dump (nor indeed in any 8.x version).
Therefore, you are running pg_dump 7.x, whether you believe it or not.
The error message you'd get if you removed the -i switch would provide
further proof, if you require it.
> pg_dump out of chroot work
> in chroot doesnt work...mystery
Doesn't sound very mysterious to me. You've got an old copy of pg_dump
somewhere inside the chroot, and perhaps a PATH setting different from
what you think it is.
regards, tom lane