Re: proposal: alternative psql commands quit and exit

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, 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-02-01 12:47:14
Message-ID: 20180201124714.GA20358@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 1, 2018 at 12:01:37PM +0100, Daniel Verite wrote:
> Bruce Momjian wrote:
>
> > One open issue is the existing help display is inaccurate on Windows:
> >
> > Use \\? for help or press control-C to clear the input buffer.
>
> ! #ifndef WIN32
> ! puts(_("Use control-D to quit."));
> ! #else
> ! puts(_("Use control-C to quit."));
> ! #endif
>
> But Control-C exiting on Windows is a bug, isn't it?
> Shouldn't we try to fix it to behave like in Unix
> rather than documenting it?
>
> Also, the fact that Control-D can quit in the middle of a
> multiline query without any confirmation is a usability problem, because
> you can always fat-finger a Ctrl+key. By comparison, bash doesn't
> accept it and emits the same error as if a script was improperly
> terminated. Example:
>
> $ cat '
> > [Hit Ctrl+D here] bash: unexpected EOF while looking for matching `''
> bash: syntax error: unexpected end of file
> $
>
> There's also the issue that, in general, communicating different hints
> and advice depending on the host operating system is not ideal.
> Because people ask "how do I do such and such in psql?",
> they do not ask "how do I do such and such in psql in Windows?".

Well, the exit/quit API is just for users to get things done quickly,
for typing portability. I don't think it is something that has to have
a consistent API.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2018-02-01 13:10:54 Re: proposal: alternative psql commands quit and exit
Previous Message Simon Riggs 2018-02-01 12:45:09 Re: [HACKERS] MERGE SQL Statement for PG11