Re: Making tab-complete.c easier to maintain

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Making tab-complete.c easier to maintain
Date: 2015-12-29 16:21:49
Message-ID: 1011.1451406109@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
>> On Sun, Dec 20, 2015 at 6:24 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Karlsson 2015-12-29 16:22:42 COPY (... tab completion
Previous Message Boriss Mejias 2015-12-29 16:13:52 Re: Testing Postgresql 9.5 RC1 with Alfresco 5.0.d