Thread: strange message from pg_dumpall

strange message from pg_dumpall

From
Joao Miguel Ferreira
Date:
Hello all,

I got surprised by this message:

-------------------------------------
The program "pg_dump" is needed by pg_dumpall but was not found in the
same directory as "/usr/bin/pg_dumpall".
Check your installation.
--------------------------------------

It's quite strange because I'm quite the pg_* binaries are well
installed:

----------------------------------------
$ ls -la /usr/bin/ | grep pg_
-rwxr-xr-x    1 admin    root        16632 Oct 16 17:39 pg_config
-rwxr-xr-x    1 admin    root        16636 Oct 16 17:39 pg_controldata
-rwxr-xr-x    1 admin    root        24880 Oct 16 17:39 pg_ctl
-rwxr-xr-x    1 admin    root       187996 Oct 16 17:39 pg_dump
-rwxr-xr-x    1 admin    root        43444 Oct 16 17:39 pg_dumpall
-rwxr-xr-x    1 admin    root        23020 Oct 16 17:39 pg_resetxlog
-rwxr-xr-x    1 admin    root        84460 Oct 16 17:39 pg_restore
$
----------------------------------------

This is what I do:

system("su postgres -c \"pg_dumpall --clean > some_file\"");

this is run from within a Perl module called from within a Perl script.

I've tried the same command directlly on the shell and it works fine.
But from the perl script it complaints about pg_dump !!!???

I've even tested both commands directlly on the cmd line and they work
properlly !

any ideas ?

thx
joao




Re: strange message from pg_dumpall

From
"T.J. Adami"
Date:
On 31 out, 06:56, joao.mc.ferre...@criticalsoftware.com (Joao Miguel
Ferreira) wrote:
> Hello all,
>
> I got surprised by this message:
>
> -------------------------------------
> The program "pg_dump" is needed by pg_dumpall but was not found in the
> same directory as "/usr/bin/pg_dumpall".
> Check your installation.
> --------------------------------------
>
> It's quite strange because I'm quite the pg_* binaries are well
> installed:
>
> ----------------------------------------
> $ ls -la /usr/bin/ | grep pg_
> -rwxr-xr-x    1 admin    root        16632 Oct 16 17:39 pg_config
> -rwxr-xr-x    1 admin    root        16636 Oct 16 17:39 pg_controldata
> -rwxr-xr-x    1 admin    root        24880 Oct 16 17:39 pg_ctl
> -rwxr-xr-x    1 admin    root       187996 Oct 16 17:39 pg_dump
> -rwxr-xr-x    1 admin    root        43444 Oct 16 17:39 pg_dumpall
> -rwxr-xr-x    1 admin    root        23020 Oct 16 17:39 pg_resetxlog
> -rwxr-xr-x    1 admin    root        84460 Oct 16 17:39 pg_restore
> $
> ----------------------------------------
>
> This is what I do:
>
> system("su postgres -c \"pg_dumpall --clean > some_file\"");
>
> this is run from within a Perl module called from within a Perl script.
>
> I've tried the same command directlly on the shell and it works fine.
> But from the perl script it complaints about pg_dump !!!???
>
> I've even tested both commands directlly on the cmd line and they work
> properlly !
>
> any ideas ?
>
> thx
> joao
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

Did you try to create a simple batch file and call it with sh?

pgdumpall.sh:
su -c "pg_dumpall --clean > some_file" postgres

And inside your code:
system("sh pgdumpall.sh");

... it's one idea... I had some problemas on other OS like windows,
when I need to create a batch to call some executables that aren't at
the same path of my application.


Re: strange message from pg_dumpall

From
Tom Lane
Date:
Joao Miguel Ferreira <joao.mc.ferreira@criticalsoftware.com> writes:
> This is what I do:
> system("su postgres -c \"pg_dumpall --clean > some_file\"");

This is going to try to find pg_dumpall in whatever PATH is currently
active within the script --- maybe there's something bogus about that
path?  Personally I'd use "su - postgres".

            regards, tom lane

Re: strange message from pg_dumpall

From
Joao Miguel Ferreira
Date:
> | system("su postgres -c \"pg_dumpall --clean > some_file\"");
>
> I'd try "su - postgres ..."; this will use postgres' environment here.
>

That was a good one but still didn't work....




> | this is run from within a Perl module called from within a Perl script.
> |
> | I've tried the same command directlly on the shell and it works fine.
> | But from the perl script it complaints about pg_dump !!!???
>
> What does "type -a pg_dump" output? Maybe it's a leftover from an

it returns /usr/bin/pg_dump, just like 'which pd_dump' does !!!

well, never mind I found a diferent solution... I run the command from
within a shell script and just have the Perl call that script... it's
working... thx

joao

> incomplete uninstall of a PostgreSQL installation?
>
> Ciao,
> Thomas
>


Re: strange message from pg_dumpall

From
Thomas Pundt
Date:
On Mittwoch, 31. Oktober 2007, Joao Miguel Ferreira wrote:
| I got surprised by this message:
|
| -------------------------------------
| The program "pg_dump" is needed by pg_dumpall but was not found in the
| same directory as "/usr/bin/pg_dumpall".
| Check your installation.
| --------------------------------------
[...]
| This is what I do:
|
| system("su postgres -c \"pg_dumpall --clean > some_file\"");

I'd try "su - postgres ..."; this will use postgres' environment here.

| this is run from within a Perl module called from within a Perl script.
|
| I've tried the same command directlly on the shell and it works fine.
| But from the perl script it complaints about pg_dump !!!???

What does "type -a pg_dump" output? Maybe it's a leftover from an
incomplete uninstall of a PostgreSQL installation?

Ciao,
Thomas

--
Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/ ----

Re: strange message from pg_dumpall

From
Tom Lane
Date:
Joao Miguel Ferreira <joao.mc.ferreira@criticalsoftware.com> writes:
> This is what I do:

> system("su postgres -c \"pg_dumpall --clean > some_file\"");

> this is run from within a Perl module called from within a Perl script.

> I've tried the same command directlly on the shell and it works fine.
> But from the perl script it complaints about pg_dump !!!???

Maybe strace would yield some useful info, ie

system("su postgres -c \"strace -f pg_dumpall --clean > some_file 2>strace.out\"");

What platform and PG version is this exactly?

            regards, tom lane