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 394633.1673398588@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] support tab-completion for single quote input with equal sign  (torikoshia <torikoshia@oss.nttdata.com>)
Responses Re: [PATCH] support tab-completion for single quote input with equal sign  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
torikoshia <torikoshia@oss.nttdata.com> writes:
> I updated the patch going along with the v3 direction.

I think this adds about as many failure modes as it removes,
if not more.

* The connection string doesn't necessarily end with "'"; it could
be a dollar-quoted string.

* If it is a dollar-quoted string, there could be "'" marks internal
to it, allowing PUBLICATION to be falsely offered when we're really
still within the connection string.

* The following WITH options could contain "'", allowing PUBLICATION
to be falsely offered within that clause.

I've spent some effort previously on getting tab-completion to deal
sanely with single-quoted strings, but everything I've tried has
crashed and burned :-(, mainly because it's not clear when to take
the whole literal as one "word" and when not.  A relevant example
here is that somebody might wish that we could tab-complete within
the connection string, e.g. that

CREATE SUBSCRIPTION sub CONNECTION 'db<TAB>

would complete with "name=".  We have the info available from libpq
to do that, if only we could figure out when to apply it.  I think
we need some pretty fundamental design work to figure out what we
want to do in this area, and that in the meantime putting band-aids
on specific cases is probably not very productive.

            regards, tom lane



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Todo: Teach planner to evaluate multiple windows in the optimal order
Next
From: Michael Paquier
Date:
Subject: Re: Strengthen pg_waldump's --save-fullpage tests