Re: psql case preserving completion

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql case preserving completion
Date: 2012-01-17 07:46:07
Message-ID: CAHGQGwFkTWOFK4P1y7VBXqLdu_4ZN8b138736waoMm4c4y5E0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 12, 2012 at 5:29 AM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> In psql, the tab completion always converts key words to upper case.  In
> practice, I and I think most users type in lower case.  So then you end
> up with commands looking like this:
>
> => alter TABLE foo add CONSTRAINT bar check (a > 0);
>
> To address this, I have implemented a slightly different completion mode
> that looks at the word being completed and converts the completed word
> to the case of the original word.  (Well, it looks at the first letter.)
>
> In fact, since almost all completions in psql are of this nature, I made
> this the default mode for COMPLETE_WITH_CONST and COMPLETE_WITH_LIST and
> added a new macro COMPLETE_WITH_LIST_CS that uses the old case-sensitive
> behavior. The latter is used mainly for completing backslash commands.
>
> After playing with this a little, I find the behavior more pleasing.
> Less yelling. ;-)
>
> Patch attached.

When I tested the patch, "create ta" was converted unexpectedly to
"create TABLE"
though "alter ta" was successfully converted to "alter table". As far
as I read the patch,
you seems to have forgotten to change create_or_drop_command_generator() or
something.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2012-01-17 08:04:06 Re: Collect frequency statistics for arrays
Previous Message Fujii Masao 2012-01-17 06:52:30 Re: WAL Restore process during recovery