Re: tab completion of enum values is broken

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tab completion of enum values is broken
Date: 2022-01-14 22:48:39
Message-ID: 3430513.1642200519@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Oh ... experimenting on macOS (with the system-provided libedit)
> shows no bug here. So I guess we'll need to make this conditional
> somehow, perhaps on USE_FILENAME_QUOTING_FUNCTIONS. That's another
> reason for not going overboard.

After further fooling with that, I concluded that the only workable
solution is a run-time check for whether the readline library included
the leading quote in what it hands us. A big advantage of doing it this
way is that it mostly fixes my complaint #1: by crafting the check
properly, we will include quotes if the user hits TAB without having typed
anything, and we won't complete an incorrectly non-quoted identifier.
There's still nothing to be done about single quotes inside an enum
label, but I'm okay with blowing that case off.

So I think the attached is committable. I've tried it on readline
7.0 (RHEL8) as well as whatever libedit Apple is currently shipping.

regards, tom lane

Attachment Content-Type Size
enum-completion-2.patch text/x-diff 5.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kingsborough, Alex 2022-01-14 22:49:59 Null commitTS bug
Previous Message Andres Freund 2022-01-14 22:44:20 Re: Why is src/test/modules/committs/t/002_standby.pl flaky?