Re: Making tab-complete.c easier to maintain

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Making tab-complete.c easier to maintain
Date: 2015-12-13 23:10:12
Message-ID: CAEepm=1x-inE_3Hsa07Wp5zDg2puGR1TdJsstgm0=ATXpxur=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Dec 13, 2015 at 1:08 AM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Wed, Dec 9, 2015 at 8:17 PM, Thomas Munro wrote:
>> Thanks for looking at this Michael. It's probably not much fun to
>> review! Here is a new version with that bit removed. More responses
>> inline below.
>
> Could this patch be rebased? There are now conflicts with 8b469bd7 and
> it does not apply cleanly.

New version attached.

I've also add (very) primitive negative pattern support and used it in
5 places. Improvement? Examples:

/* ALTER TABLE xxx RENAME yyy */
- else if (TailMatches5("ALTER", "TABLE", MatchAny, "RENAME", MatchAny) &&
- !TailMatches1("CONSTRAINT|TO"))
+ else if (TailMatches5("ALTER", "TABLE", MatchAny, "RENAME",
"!CONSTRAINT|TO"))
COMPLETE_WITH_CONST("TO");

/* If we have CLUSTER <sth>, then add "USING" */
- else if (TailMatches2("CLUSTER", MatchAny) &&
!TailMatches1("VERBOSE|ON"))
+ else if (TailMatches2("CLUSTER", "!VERBOSE|ON"))
COMPLETE_WITH_CONST("USING");

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
tab-complete-macrology-v10.patch.gz application/x-gzip 19.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2015-12-13 23:40:57 Re: Using quicksort for every external sort run
Previous Message Jeff Janes 2015-12-13 22:43:55 Re: Using quicksort for every external sort run