Re: Making tab-complete.c easier to maintain - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Making tab-complete.c easier to maintain
Date
Msg-id 1011.1451406109@sss.pgh.pa.us
Whole thread Raw
In response to Re: Making tab-complete.c easier to maintain  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: Making tab-complete.c easier to maintain  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
Michael Paquier <michael.paquier@gmail.com> writes:
>> On Sun, Dec 20, 2015 at 6:24 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> 1. I think it would be a good idea to convert the matching rules for
>>> backslash commands too.  To do that, we'd need to provide a case-sensitive
>>> equivalent to word_match and the matching macros.  I think we'd also have
>>> to extend word_match to allow a trailing wildcard character, maybe "*".

> I am not really sure I follow much the use of the wildcard, do you
> mean to be able to work with the [S] extensions of the backslash
> commands which are not completed now?

But they are completed:

regression=# \dfS str<TAB>
string_agg          string_agg_transfn  strip
string_agg_finalfn  string_to_array     strpos

This is because of the use of strncmp instead of plain strcmp
in most of the backslash matching rules, eg the above case is
covered by
else if (strncmp(prev_wd, "\\df", strlen("\\df")) == 0)

I was envisioning that we'd want to convert this to something like
else if (TailMatchesCS1("\\df*"))
        regards, tom lane



pgsql-hackers by date:

Previous
From: Boriss Mejias
Date:
Subject: Re: Testing Postgresql 9.5 RC1 with Alfresco 5.0.d
Next
From: Andreas Karlsson
Date:
Subject: COPY (... tab completion