Re: [PATCH] support tab-completion for single quote input with equal sign - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] support tab-completion for single quote input with equal sign
Date
Msg-id 2698203.1630767477@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] support tab-completion for single quote input with equal sign  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses RE: [PATCH] support tab-completion for single quote input with equal sign
List pgsql-hackers
I wrote:
> Surely this patch is completely wrong?  It needs more thought about
> the interaction with the existing logic for double quotes, ie single
> quote inside double quotes is not special, nor the reverse; nor should
> parentheses inside quotes be counted.  It also needs to be aware of
> backslashes in escape-style strings.

Actually ... those are just implementation details, and now that
I've thought about it a little more, I question the entire concept
of making single-quoted strings be single words in tab-complete's
view.  I think it's quite intentional that we don't do that;
if we did, it'd forever foreclose the possibility of tab-completing
*within* strings.  You don't have to look any further than CREATE
SUBSCRIPTION itself to see possible applications of that: someone
could wish that

CREATE SUBSCRIPTION my_sub CONNECTION 'db<TAB>

would complete with "name=", or that <TAB> right after the quote
would offer a list of connection keywords.

(More generally, I'm afraid that people are already relying on this
behavior in other contexts, and thus that the proposed patch could
break more use-cases than it fixes.)

So now I think that this approach should be rejected, and that the
right thing is to fix the CREATE SUBSCRIPTION completion rules
to allow more than one "word" between CONNECTION and PUBLICATION.

Another idea that might be useful is to treat the opening and
closing quotes themselves as separate "words", which'd give
the CREATE SUBSCRIPTION rules a bit more to go on about when to
offer PUBLICATION.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Column Filtering in Logical Replication
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] support tab-completion for single quote input with equal sign