On Saturday, September 4, 2021 11:58 PM, Tom Lane <t...@sss.pgh.pa.us> wrote:
>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.)

Agreed. Thanks for your comments.

>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.

Treat the opening and closing quotes themselves as separate "words" may affect 
some current tap completion.
So I tried to fix the CREATE SUBSCRIPTION completion rules in the V3 patch.
The basic idea is to check the head words of the input text as "CREATE 
SUBSCRIPTION subname CONNECTION anystring", 
then check to see if anystring ends with single quote. If all check passed, 
PUBLICATION will be auto-completed.

Tap tests(including the one added in V3) has been passed.

Regards,
Tang

Attachment: v3-0001-support-tab-completion-for-CONNECTION-string-with.patch
Description: v3-0001-support-tab-completion-for-CONNECTION-string-with.patch

Reply via email to