Skip site navigation (1) Skip section navigation (2)

Solaris - psql returns 0 instead of 1 for file not found.

From: "Clark, Andrew" <Andrew(dot)Clark(at)fnf(dot)com>
To: <pgsql-ports(at)postgresql(dot)org>
Subject: Solaris - psql returns 0 instead of 1 for file not found.
Date: 2005-09-19 18:01:03
Message-ID: 74825F195D477C4995425A1313D646B114A923@smbfisyyz01.FNFIS.COM (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patchespgsql-ports
Hi all,

I've found the when psql is used with the -f flag and the specified file
doesn't exist the rc value is 0.

$ uname -a
SunOS bld 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Fire-V440

$ psql -V
psql (PostgreSQL) 8.0.2

$ ls foo
foo: No such file or directory

$ psql -f foo
foo: No such file or directory
 
$ echo $?
0

However, in the man page for psql it says:

EXIT STATUS
     psql returns 0 to the shell if it finished normally, 1 if  a
     fatal  error  of  its  own  (out  of memory, file not found)
     occurs, ...

I'm assuming this is the same with other platforms, but I only use
PostgreSQL on Solaris.

Has this been fix in 8.0.3?

Cheers,
Andrew

Responses

pgsql-ports by date

Next:From: Bruce MomjianDate: 2005-09-20 19:00:56
Subject: Re: [PORTS] Solaris - psql returns 0 instead of 1 for file not found.
Previous:From: Merlin MoncureDate: 2005-09-19 15:24:59
Subject: Re: could help me?

pgsql-bugs by date

Next:From: Wade HamptonDate: 2005-09-19 18:18:55
Subject: BUG #1897: dmalloc memory error on PQconnectdb
Previous:From: Tom LaneDate: 2005-09-19 15:25:19
Subject: Re: BUG #1893: pg_dumpall - Search path order

pgsql-patches by date

Next:From: Tom LaneDate: 2005-09-19 20:33:27
Subject: Re: [PATCH] Add support for IS NULL to btree indexes
Previous:From: Martijn van OosterhoutDate: 2005-09-19 17:51:07
Subject: [PATCH] Add support for IS NULL to btree indexes

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group