Re: proposal: alternative psql commands quit and exit - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: proposal: alternative psql commands quit and exit
Date
Msg-id CAMsr+YGRPzD1C-0kUcVz=8V3uORuddDbKzLtfJwd+1Ht4POmYQ@mail.gmail.com
Whole thread Raw
In response to Re: proposal: alternative psql commands quit and exit  (Chapman Flack <chap@anastigmatix.net>)
Responses Re: proposal: alternative psql commands quit and exit
List pgsql-hackers
On 12 December 2017 at 05:38, Chapman Flack <chap@anastigmatix.net> wrote:
On 12/11/2017 04:16 PM, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>> No opinion on that, but if the problem is that people don't know how to
>> quit psql, then we should just put that information back into the
>> welcome message and be done with it.
>
> I don't think people read the welcome message, or at least they
> immediately forget it.

I'm still a wholehearted supporter of Robert's idea in

https://www.postgresql.org/message-id/CA%2BTgmoZswp00PtcgPfQ9zbbh7HUTgsLLJ9Z1x9E2s8Y7ep048g%40mail.gmail.com

to simply produce helpful messages to stderr when isatty(stdin) and
'exit' or 'quit' arrives on a line by itself.

+1 from me. In part because scripts you write on pg11 won't break on older versions with weird errors due to lack of 'exit' / 'quit' . 

As others noted, 'help' is a precedent here.

I don't even think it's necessarily worthwhile to treat them any
differently when *not* on a continuation line. Why not just always
have a bare 'exit' or 'quit', when isatty(stdin), give you a little
reminder about \?, \q, ^C/\r and leave the next step up to you?

This makes me a little nervous... but the counter-argument is that I see a lot of stack overflow questions with variants on "nothing is working in psql". Because they didn't use a semicolon. So they're stuck in a continuation, mashing help and quit and exit and wondering wtf is going on. The same happens with people who get stuck in quote continuations or open-parens continuations, where semicolon doesn't help them either.

Experienced users on unixes will try control-D, but unless you've used unix a while that's not going to occur to you.

I doubt I've ever written just "exit" or "quit" without indentation. I think if it requires them to be a bareword with no indentation, strictly ^(exit|quit)\n when isatty, then that's probably a safe and helpful choice.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Testing Extension Upgrade Paths
Next
From: Etsuro Fujita
Date:
Subject: Re: Incorrect debug info printed in generate_partition_wise_join_paths