Re: proposal: alternative psql commands quit and exit

From: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Everaldo Canuto <everaldo(dot)canuto(at)gmail(dot)com>, Chapman Flack <chap(at)anastigmatix(dot)net>, Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: alternative psql commands quit and exit
Date: 2018-01-17 11:50:54
Message-ID: CAEzk6fdimHQvN5Lv-ZCUn-pRfuZSpRdfE5MmtCj8Wns1PjfoRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16 January 2018 at 17:20, Robert Haas <robertmhaas(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2018-01-17 12:38:32 Re: [HACKERS] [BUGS] Bug in Physical Replication Slots (at least 9.5)?
Previous Message Antonin Houska 2018-01-17 11:46:29 Unnecessary static variable?