error codes when running pg_dumpall from a perl script.

Started by Simon Cruteover 24 years ago4 messagesgeneral
Jump to latest
#1Simon Crute
simon-news@nospam.geordie.demon.co.uk

Hi,
If this was better posed in a different postgres group, please let me
know.

I'm having problems when running pg_dumpall from a perl script.

Here's the line that's executing the backup.

`pg_dumpall -o |bzip2 -z -c > $os_bkup_loc/byt_pgdump_full.bz2` or warn
"Error while running probably all OK. $! \n";

During the run the following error is reported

"Error while running probably all OK.. Illegal seek "
i.e. the error code reported by $! is "Illegal seek"

I've ran a backup manually, and there are no error messages.
When running the backup from with a perl script, (but not sending the output
through bzip2) the error still occurs, but diffing the output of that with
the output of pg_dumpall -o when ran from the command line and there's only
two minor differences (which seem to be within some objectIDs. I can post
that diff if anyone thinks it may help.

the environment variables PGUSER and PGPASSWORD are set earlier in the
script.
I've searched the archives of the mail lists, and found no references to
illegal seeks WRT running pg_dump.

Anyone got any clues ?

--
Simon Crute

#2Allan Engelhardt
allane@cybaea.com
In reply to: Simon Crute (#1)
Re: error codes when running pg_dumpall from a perl script.

You'll want to ask on the perl groups, but briefly you get an illegal seek when your command writes to the error file descriptor:

% perl -e '`echo hi 1>&2` or warn "Oops: $! $?";'
hi
Oops: Illegal seek 0 at -e line 1.

It's a perl feature, not a bug ;-) Try

% man perlop

for self therapy...

Allan.

Simon Crute wrote:

Show quoted text

Hi,
If this was better posed in a different postgres group, please let me
know.

I'm having problems when running pg_dumpall from a perl script.

Here's the line that's executing the backup.

`pg_dumpall -o |bzip2 -z -c > $os_bkup_loc/byt_pgdump_full.bz2` or warn
"Error while running probably all OK. $! \n";

During the run the following error is reported

"Error while running probably all OK.. Illegal seek "
i.e. the error code reported by $! is "Illegal seek"

I've ran a backup manually, and there are no error messages.
When running the backup from with a perl script, (but not sending the output
through bzip2) the error still occurs, but diffing the output of that with
the output of pg_dumpall -o when ran from the command line and there's only
two minor differences (which seem to be within some objectIDs. I can post
that diff if anyone thinks it may help.

the environment variables PGUSER and PGPASSWORD are set earlier in the
script.
I've searched the archives of the mail lists, and found no references to
illegal seeks WRT running pg_dump.

Anyone got any clues ?

--
Simon Crute

#3Simon Crute
simon-news@nospam.geordie.demon.co.uk
In reply to: Simon Crute (#1)
Re: error codes when running pg_dumpall from a perl script.

"Allan Engelhardt" <allane@cybaea.com> wrote in message
news:3BC5F048.278EE105@cybaea.com...

You'll want to ask on the perl groups, but briefly you get an illegal seek

when your command writes to the error file descriptor:

% perl -e '`echo hi 1>&2` or warn "Oops: $! $?";'
hi
Oops: Illegal seek 0 at -e line 1.

It's a perl feature, not a bug ;-) Try

Ahh.
Thanks for that.

#4Keary Suska
hierophant@pcisys.net
In reply to: Simon Crute (#1)
Re: error codes when running pg_dumpall from a perl

backticks return STDOUT, not a status condition. Use system() instead:
system( "pg_dumpall -o |bzip2 -z -c > $os_bkup_loc/byt_pgdump_full.bz2"
) and warn "Error while running: $! \n";

You must use "and" because system() returns 0 on success, or an error code
on failure. Or you can check $?.

Caveat programmor: an error status would only be returned if the initial
shell returns an error, and broken pipes do not return errors

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

Show quoted text

From: "Simon Crute" <simon-news@nospam.geordie.demon.co.uk>
Date: Thu, 11 Oct 2001 07:30:47 +0100
To: pgsql-general@postgresql.org
Subject: [GENERAL] error codes when running pg_dumpall from a perl script.

Hi,
If this was better posed in a different postgres group, please let me
know.

I'm having problems when running pg_dumpall from a perl script.

Here's the line that's executing the backup.

`pg_dumpall -o |bzip2 -z -c > $os_bkup_loc/byt_pgdump_full.bz2` or warn
"Error while running probably all OK. $! \n";

During the run the following error is reported

"Error while running probably all OK.. Illegal seek "
i.e. the error code reported by $! is "Illegal seek"

I've ran a backup manually, and there are no error messages.
When running the backup from with a perl script, (but not sending the output
through bzip2) the error still occurs, but diffing the output of that with
the output of pg_dumpall -o when ran from the command line and there's only
two minor differences (which seem to be within some objectIDs. I can post
that diff if anyone thinks it may help.

the environment variables PGUSER and PGPASSWORD are set earlier in the
script.
I've searched the archives of the mail lists, and found no references to
illegal seeks WRT running pg_dump.

Anyone got any clues ?

--
Simon Crute

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org