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
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.