Re: proposal: alternative psql commands quit and exit

From: Jeremy Finzel <finzelj(at)gmail(dot)com>
To:
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: proposal: alternative psql commands quit and exit
Date: 2017-12-12 15:04:55
Message-ID: CAMa1XUgcMh0_2WTxira7V0vd8N7-AYcE6+4HiJ2NJ=-607n8hw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Someone mentioned about needing to read the documentation of vim to learn
how to exit the program. I personally think exactly the same applies here,
and am a bit surprised at the depth of discussion over this.

When I first was new to cli programs, the only "standard" way to exit a
program I found across the board was CTRL+D. I have never even thought
that psql, even though different, was odd in its choice of how to exit the
program. And their choices for why \q is used in a SQL cli program have
very good reasons as has been discussed.

So what if that stack overflow is the most hit on psql questions? How many
of you have learned what you need within 5 seconds on google? I don't
think this is a significant stumbling block for users adopting postgres.
psql is amazing and for anyone who likes cli programs, they will be fine.

FWIW I am +1 in favor of not overcomplicating the special psql commands and
keep to the "\" standard.

On Tue, Dec 12, 2017 at 8:35 AM, Gasper Zejn <zejn(at)owca(dot)info> wrote:

> On 12. 12. 2017 06:58, Tom Lane wrote:
> > Craig Ringer <craig(at)2ndquadrant(dot)com> writes:
> >> 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.
> > FWIW, I think that the special behavior (whatever it winds up being
> > exactly) ought to trigger on an input line matching
> >
> > [whitespace]*help[whitespace]*(;[whitespace]*)?
> >
> > and similarly for exit/quit. I think that novices might have
> internalized
> > enough SQL syntax to think that they need to terminate the command with a
> > semicolon --- in fact, we regularly see examples in which seasoned users
> > think they need to terminate backslash commands with a semicolon, so
> > that's hardly far-fetched. And we might as well allow as much whitespace
> > as we can, because nobody but Guido Rossum thinks that having whitespace
> > be semantically significant is a good idea.
> >
> > regards, tom lane
> >
> If tabs are considered whitespace, psql can sometimes treat it as
> semantically significant, since
> "create materialized<tab>test11 as select 1;" will be autocompleted to
> correct syntax if you paste the line into interactive psql session.
>
> I have seen psql error out with invalid syntax when a similar query was
> pasted and psql autocompleted it.
>
> kind regards, Gasper
>
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2017-12-12 15:07:11 Re: [HACKERS] Custom compression methods
Previous Message Robert Haas 2017-12-12 15:03:09 Re: [HACKERS] Transactions involving multiple postgres foreign servers