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

Re: [PORTS] Solaris - psql returns 0 instead of 1 for file not found.

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: pgsql-bugs(at)postgresql(dot)org
Cc: pgsql-ports(at)postgresql(dot)org,"Clark, Andrew" <Andrew(dot)Clark(at)fnf(dot)com>
Subject: Re: [PORTS] Solaris - psql returns 0 instead of 1 for file not found.
Date: 2005-09-22 16:03:51
Message-ID: 200509221603.j8MG3pr22924@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patchespgsql-ports
A patch has been applied and this will be fixed in 8.0.4 and 8.1beta3.

---------------------------------------------------------------------------

Robert Treat wrote:
> On Monday 19 September 2005 14:01, Clark, Andrew wrote:
> > 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?
> >
> 
> Redirecting to -bugs since I've confirmed this behavior on Slackware Linux 10 
> with psql version 8.1beta1 and there does seem to be something wrong with the 
> above situation  (perhaps the man page needs to be reworded?)
> 
> -- 
> Robert Treat
> Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-ports by date

Next:From: Michael CrozierDate: 2005-09-27 23:38:12
Subject: TAS definitions on Solaris x86 with GCC
Previous:From: Robert TreatDate: 2005-09-22 16:00:08
Subject: Re: [PORTS] Solaris - psql returns 0 instead of 1 for file not found.

pgsql-bugs by date

Next:From: SriKumar KaretiDate: 2005-09-22 16:48:35
Subject: Re: possible bug...
Previous:From: Robert TreatDate: 2005-09-22 16:00:08
Subject: Re: [PORTS] Solaris - psql returns 0 instead of 1 for file not found.

pgsql-patches by date

Next:From: Tom LaneDate: 2005-09-22 22:29:11
Subject: Proposed patch to clean up signed-ness warnings
Previous:From: Robert TreatDate: 2005-09-22 16:00:08
Subject: Re: [PORTS] Solaris - psql returns 0 instead of 1 for file not found.

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