Re: proposal: alternative psql commands quit and exit

From: Everaldo Canuto <everaldo(dot)canuto(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: proposal: alternative psql commands quit and exit
Date: 2017-12-08 11:24:05
Message-ID: CACYgWU=KorigPcWdMQrQrcRdLRSap-EehNd5S-nEzvG1dQtsRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 8, 2017 at 8:10 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:
>
> I think that you are going to need better reasons than just being more
> friendly with other database clients by breaking a rule which is
> around for 20 years.

Well, that reason was enough for other sql clients to implement "\q" and
"\quit" even if they don't use "\" commands.
Note that we are not breaking a rule, we already have "help" without slash
and as I said, "slash way" still supported and still oficial way to exit.

> For one, it seems to me that your patch is
> breaking multi-line SQL support with psql, as "quit" or "exit" are
> legit SQL object names.
>

No, it is not breaking. Did you test it? My patch takes care of multi-line
commands. Look at second line of patch:

pset.cur_cmd_interactive && query_buf->len == 0

Line 4 also take care about other possible problems:

(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))

I know that this "feature" don't make any difference for most of you guys
but also it will not hurt anyone and will help a little for newcomers and
people that uses different sql clients. To be honest. I could understand
that is not a good idea to accept patches like this if it is too big since
it could make things hard to maintainers but honestly, this patch is very
small and trivial.

Regards.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2017-12-08 11:50:20 Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug
Previous Message Amit Langote 2017-12-08 10:40:35 no partition pruning when partitioning using array type