Re: proposal: alternative psql commands quit and exit

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: proposal: alternative psql commands quit and exit
Date: 2017-12-12 02:04:55
Message-ID: CAMsr+YGRPzD1C-0kUcVz=8V3uORuddDbKzLtfJwd+1Ht4POmYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12 December 2017 at 05:38, Chapman Flack <chap(at)anastigmatix(dot)net> wrote:

> On 12/11/2017 04:16 PM, Tom Lane wrote:
> > Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)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%2BTgmoZswp00PtcgPfQ9zbbh7HUTgs
> LLJ9Z1x9E2s8Y7ep048g%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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2017-12-12 02:05:36 Re: Incorrect debug info printed in generate_partition_wise_join_paths
Previous Message Craig Ringer 2017-12-12 01:55:52 Re: Testing Extension Upgrade Paths