Re: [HACKERS] Allowing nonzero return codes from \quit

2017-01-23 Thread Tom Lane
Fabien COELHO writes: >> I didn't think about it too much, but I don't see why a user couldn't set >> one of those error codes. >> I did, however, think that any attempt to set an exit_code outside of >> [0,127] would itself be an error, resulting in an exit code of 3. >

Re: [HACKERS] Allowing nonzero return codes from \quit

2017-01-23 Thread Fabien COELHO
As \q does not currently have an argument, this seems an easy and reasonnable extension. However, currently there are 4 existing exit status for psql: 0 (ok), 1 (fatal error), 2 (connection error), 3 (script error...). +128 status are also already used when killing a psql process. I didn't

Re: [HACKERS] Allowing nonzero return codes from \quit

2017-01-23 Thread Corey Huinker
On Mon, Jan 23, 2017 at 1:26 PM, Fabien COELHO wrote: > > \quit 4 >>> >> > As \q does not currently have an argument, this seems an easy and > reasonnable extension. > > However, currently there are 4 existing exit status for psql: 0 (ok), 1 > (fatal error), 2 (connection

Re: [HACKERS] Allowing nonzero return codes from \quit

2017-01-23 Thread Fabien COELHO
\quit 4 As \q does not currently have an argument, this seems an easy and reasonnable extension. However, currently there are 4 existing exit status for psql: 0 (ok), 1 (fatal error), 2 (connection error), 3 (script error...). +128 status are also already used when killing a psql

Re: [HACKERS] Allowing nonzero return codes from \quit

2017-01-23 Thread Pavel Stehule
2017-01-23 19:09 GMT+01:00 Corey Huinker : > Another suggestion to come out of the \quit_if discussion was that someone > might want to send a return code other than 0 back. Something like this: > > \quit 4 > > or even: > > > \set exit_code 127 > \quit :exit_code > > This

[HACKERS] Allowing nonzero return codes from \quit

2017-01-23 Thread Corey Huinker
Another suggestion to come out of the \quit_if discussion was that someone might want to send a return code other than 0 back. Something like this: \quit 4 or even: \set exit_code 127 \quit :exit_code This isn't a personal need of mine, but I figured it was an idea worth discussing on its