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

From Jeremy Finzel
Subject Re: proposal: alternative psql commands quit and exit
Date
Msg-id CAMa1XUgcMh0_2WTxira7V0vd8N7-AYcE6+4HiJ2NJ=-607n8hw@mail.gmail.com
Whole thread Raw
In response to Re: proposal: alternative psql commands quit and exit  (Gasper Zejn <zejn@owca.info>)
Responses Re: proposal: alternative psql commands quit and exit  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: proposal: alternative psql commands quit and exit  (Arthur Nascimento <tureba@gmail.com>)
List 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@owca.info> wrote:
On 12. 12. 2017 06:58, Tom Lane wrote:
> Craig Ringer <craig@2ndquadrant.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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] Transactions involving multiple postgres foreign servers
Next
From: Alexander Korotkov
Date:
Subject: Re: [HACKERS] Custom compression methods