Fixing tab-complete for dollar-names

2023-06-16 Thread 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  - 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


v001_fix_dollar_names_tab_complete.patch
Description: Binary data


Re: Fixing tab-complete for dollar-names

2023-09-19 Thread 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)





Re: Fixing tab-complete for dollar-names

2023-06-26 Thread 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  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  - 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

2023-06-26 Thread 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