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

Re: BUG #3059: psql to 'postgres' shortcut

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Phil Frost <phil(at)macprofessionals(dot)com>, Raymond Naseef <raymondnaseef(at)yahoo(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3059: psql to 'postgres' shortcut
Date: 2007-02-27 19:08:38
Message-ID: 200702271908.l1RJ8cq22938@momjian.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Magnus Hagander wrote:
> On Tue, Feb 27, 2007 at 09:06:17AM -0500, Phil Frost wrote:
> > Hrm...I haven't used windows for a while now, but isn't there an  
> > option on all shortcuts to command-line programs to make the shell  
> > pause on exit? It is something like, right click on shortcut, select  
> > 'properties', uncheck 'close shell on exit'. It would seem this would  
> > solve the problem of not being able to see errors, while also not  
> > adding a pause for programs which execute psql.bat directly.
> 
> Yes, that is exactly the point -it would be very annoying in all other
> cases, as Bruce pointed out.
> 
> I guess another option would be to add a commandline option to psql to
> pause on error, but I don't think that's going to fly ;-)

I just ran a test on Unix and found psql exits with '2' if the password
fails.  In fact, looking at the psql sources I see:
	
	#ifndef EXIT_SUCCESS
	#define EXIT_SUCCESS 0
	#endif
	
	#ifndef EXIT_FAILURE
	#define EXIT_FAILURE 1
	#endif
	
	#define EXIT_BADCONN 2
	
	#define EXIT_USER 3

Notice EXIT_BADCONN.  So, what if we call psql from a batch file, and
check for a '2' exit status, and then issue a pause for only that case?

-- 
  Bruce Momjian  <bruce(at)momjian(dot)us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

In response to

Responses

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2007-02-27 19:10:22
Subject: Re: [PATCHES] BUG #2969: Inaccuracies in Solaris FAQ
Previous:From: Magnus HaganderDate: 2007-02-27 14:23:57
Subject: Re: BUG #3059: psql to 'postgres' shortcut

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