This is a discussion on BUG #3059: psql to 'postgres' shortcut within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 3059 Logged by: Raymond Naseef Email address: raymondnaseef@yahoo.com PostgreSQL version: ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| The following bug has been logged online: Bug reference: 3059 Logged by: Raymond Naseef Email address: raymondnaseef@yahoo.com PostgreSQL version: 8.2 Operating system: Windows XP Description: psql to 'postgres' shortcut Details: The shortcut to run psql.exe added to the menus is a great think to do, but when the program stops the window closes with no pause or time delay. This is a serious issue if the login fails. Sometimes I forget to start the server, but I do not know that because I cannot read text in ~0.02 seconds. BTW, I bet some of your other .bat files have the same issue. Please run it by doing 1 or other: 1. Putting a "pause" at the end of the batch file. 2. cmd.exe /K "<command line>" (just note the "" for default user name will make this fail. Sorry I do not know how to fix that unless username has no bad-for-cmd characters in it, then quotes are not needed) ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
| |||
| Raymond Naseef wrote: > > The following bug has been logged online: > > Bug reference: 3059 > Logged by: Raymond Naseef > Email address: raymondnaseef@yahoo.com > PostgreSQL version: 8.2 > Operating system: Windows XP > Description: psql to 'postgres' shortcut > Details: > > The shortcut to run psql.exe added to the menus is a great think to do, but > when the program stops the window closes with no pause or time delay. > > This is a serious issue if the login fails. Sometimes I forget to start the > server, but I do not know that because I cannot read text in ~0.02 seconds. > > BTW, I bet some of your other .bat files have the same issue. > > Please run it by doing 1 or other: > 1. Putting a "pause" at the end of the batch file. > 2. cmd.exe /K "<command line>" > (just note the "" for default user name will make this fail. Sorry I do > not know how to fix that unless username has no bad-for-cmd characters in > it, then quotes are not needed) > These solutions are going to make psql very annoying when it does work properly. -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org |
| |||
| On Mon, Feb 26, 2007 at 09:46:24AM -0500, Bruce Momjian wrote: > Raymond Naseef wrote: > > > > The following bug has been logged online: > > > > Bug reference: 3059 > > Logged by: Raymond Naseef > > Email address: raymondnaseef@yahoo.com > > PostgreSQL version: 8.2 > > Operating system: Windows XP > > Description: psql to 'postgres' shortcut > > Details: > > > > The shortcut to run psql.exe added to the menus is a great think to do, but > > when the program stops the window closes with no pause or time delay. > > > > This is a serious issue if the login fails. Sometimes I forget to start the > > server, but I do not know that because I cannot read text in ~0.02 seconds. > > > > BTW, I bet some of your other .bat files have the same issue. > > > > Please run it by doing 1 or other: > > 1. Putting a "pause" at the end of the batch file. > > 2. cmd.exe /K "<command line>" > > (just note the "" for default user name will make this fail. Sorry I do > > not know how to fix that unless username has no bad-for-cmd characters in > > it, then quotes are not needed) > > > > These solutions are going to make psql very annoying when it does work > properly. Indeed. But it *is* also a problem the way it is now (I've noticed myself a couple of times, but never had the time to fix it) Perhaps a reasonable thing to do would be to have the shortcut point to a .BAT file that does a "pause" only if psql exits with a non-zero exitcode. Is this reasonable? Will psql always exit with non-zero when something like this happen and also importantly, willi t always exit with a zero exitcode if there is no problem? //Magnus ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| |||
| 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. On Feb 27, 2007, at 8:28 AM, Magnus Hagander wrote: > On Mon, Feb 26, 2007 at 09:46:24AM -0500, Bruce Momjian wrote: >> Raymond Naseef wrote: >>> >>> The following bug has been logged online: >>> >>> Bug reference: 3059 >>> Logged by: Raymond Naseef >>> Email address: raymondnaseef@yahoo.com >>> PostgreSQL version: 8.2 >>> Operating system: Windows XP >>> Description: psql to 'postgres' shortcut >>> Details: >>> >>> The shortcut to run psql.exe added to the menus is a great think >>> to do, but >>> when the program stops the window closes with no pause or time >>> delay. >>> >>> This is a serious issue if the login fails. Sometimes I forget >>> to start the >>> server, but I do not know that because I cannot read text in >>> ~0.02 seconds. >>> >>> BTW, I bet some of your other .bat files have the same issue. >>> >>> Please run it by doing 1 or other: >>> 1. Putting a "pause" at the end of the batch file. >>> 2. cmd.exe /K "<command line>" >>> (just note the "" for default user name will make this fail. >>> Sorry I do >>> not know how to fix that unless username has no bad-for-cmd >>> characters in >>> it, then quotes are not needed) >>> >> >> These solutions are going to make psql very annoying when it does >> work >> properly. > > Indeed. But it *is* also a problem the way it is now (I've noticed > myself a couple of times, but never had the time to fix it) > > Perhaps a reasonable thing to do would be to have the shortcut > point to > a .BAT file that does a "pause" only if psql exits with a non-zero > exitcode. > > Is this reasonable? Will psql always exit with non-zero when something > like this happen and also importantly, willi t always exit with a zero > exitcode if there is no problem? ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
| |||
| 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 ;-) //Magnus ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| |||
| 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@momjian.us> http://momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |
| ||||
| On Tue, Feb 27, 2007 at 02:08:38PM -0500, Bruce Momjian wrote: > 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 ;-) > > 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? I have applied a fix for the 8.3 pginstaller that does just this. Will be in the next snapshot/release. //Magnus ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |