Re: proposal: alternative psql commands quit and exit

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: proposal: alternative psql commands quit and exit
Дата
Msg-id CAMsr+YGRPzD1C-0kUcVz=8V3uORuddDbKzLtfJwd+1Ht4POmYQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: alternative psql commands quit and exit  (Chapman Flack <chap@anastigmatix.net>)
Ответы Re: proposal: alternative psql commands quit and exit  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Testing Extension Upgrade Paths
Следующее
От: Etsuro Fujita
Дата:
Сообщение: Re: Incorrect debug info printed in generate_partition_wise_join_paths