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

From Geoff Winkless
Subject Re: proposal: alternative psql commands quit and exit
Date
Msg-id CAEzk6fdimHQvN5Lv-ZCUn-pRfuZSpRdfE5MmtCj8Wns1PjfoRQ@mail.gmail.com
Whole thread Raw
In response to Re: proposal: alternative psql commands quit and exit  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: proposal: alternative psql commands quit and exit
List pgsql-hackers
On 16 January 2018 at 17:20, Robert Haas <robertmhaas@gmail.com> wrote:
> (1) I doubt that we want to
> override the user's terminal settings and (2) it won't work on
> non-readline builds.

I'm inclined to agree with (1). (2) is something that could be worked
around with (relatively) small effort, and in theory we could grab the
value for eof from the terminal.

Having said all that, has anyone suggested grabbing and writing out
using the "stty quit" value? That appears to work whatever level
you're at, readline-or-not, mid-line or not. It wasn't even something
I was aware of.

Here my quit value is ^\ (Ctrl-backslash)

~ stty -a | grep quit | sed -e 's/.*quit = \([^;]*\).*/\1/'
^\
~ psql -U postgres
psql (9.5.1)
Type "help" for help.

postgres=# select '
postgres'# ^\Quit
~ psql -U postgres
psql (9.5.1)
Type "help" for help.

postgres=# select $$
postgres$# ^\Quit
~ psql --no-readline -U postgres
psql (9.5.1)
Type "help" for help.

postgres=# select 'Quit

Geoff


pgsql-hackers by date:

Previous
From: Antonin Houska
Date:
Subject: Unnecessary static variable?
Next
From: Stephen Frost
Date:
Subject: Re: [HACKERS] [BUGS] Bug in Physical Replication Slots (at least9.5)?