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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
Cc: tanghy(dot)fnst(at)fujitsu(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] support tab-completion for single quote input with equal sign
Date: 2023-01-11 00:56:28
Message-ID: 394633.1673398588@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

torikoshia <torikoshia(at)oss(dot)nttdata(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-01-11 01:02:17 Re: Strengthen pg_waldump's --save-fullpage tests
Previous Message David Rowley 2023-01-11 00:54:04 Re: Todo: Teach planner to evaluate multiple windows in the optimal order