Обсуждение: Fixing tab-complete for dollar-names

Поиск
Список
Период
Сортировка

Fixing tab-complete for dollar-names

От
Mikhail Gribkov
Дата:
Hi hackers,

In modern versions of Postgres the dollar sign is a totally legal character for identifiers (except for the first character), but tab-complete do not treat such identifiers well.
For example if one try to create an Oracle-style view like this:

create view v$activity as select * from pg_stat_activity;

, he will get a normally functioning view, but psql tab-complete will not help him. Type "v", "v$" or "v$act" and press <TAB> - nothing will be suggested.

Attached is a small patch fixing this problem.
Honestly I'm a little surprised that this was not done before. Maybe, there are some special considerations I am not aware of, and the patch will break something?
What would you say?
--
 best regards,
    Mikhail A. Gribkov
Вложения

Re: Fixing tab-complete for dollar-names

От
Mikhail Gribkov
Дата:
Hi hackers,

As not much preliminary interest seem to be here, I'm sending the patch to the upcoming commitfest

--
 best regards,
    Mikhail A. Gribkov


On Sat, Jun 17, 2023 at 12:51 AM Mikhail Gribkov <youzhick@gmail.com> wrote:
Hi hackers,

In modern versions of Postgres the dollar sign is a totally legal character for identifiers (except for the first character), but tab-complete do not treat such identifiers well.
For example if one try to create an Oracle-style view like this:

create view v$activity as select * from pg_stat_activity;

, he will get a normally functioning view, but psql tab-complete will not help him. Type "v", "v$" or "v$act" and press <TAB> - nothing will be suggested.

Attached is a small patch fixing this problem.
Honestly I'm a little surprised that this was not done before. Maybe, there are some special considerations I am not aware of, and the patch will break something?
What would you say?
--
 best regards,
    Mikhail A. Gribkov

Re: Fixing tab-complete for dollar-names

От
Vik Fearing
Дата:
On 6/26/23 22:10, Mikhail Gribkov wrote:
> Hi hackers,
> 
> As not much preliminary interest seem to be here, I'm sending the patch to
> the upcoming commitfest

I have added myself as reviewer.  I already had taken a look at it, and 
it seemed okay, but I have not yet searched for corner cases.
-- 
Vik Fearing




Re: Fixing tab-complete for dollar-names

От
Heikki Linnakangas
Дата:
On 27/06/2023 02:47, Vik Fearing wrote:
> On 6/26/23 22:10, Mikhail Gribkov wrote:
>> Hi hackers,
>>
>> As not much preliminary interest seem to be here, I'm sending the patch to
>> the upcoming commitfest
> 
> I have added myself as reviewer.  I already had taken a look at it, and
> it seemed okay, but I have not yet searched for corner cases.

LGTM, pushed.

I concur it's surprising that no one's noticed or at least not bothered 
to fix this before. But I also couldn't find any cases where this would 
cause trouble.

-- 
Heikki Linnakangas
Neon (https://neon.tech)