Re: Making tab-complete.c easier to maintain

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: alvherre(at)2ndquadrant(dot)com, michael(dot)paquier(at)gmail(dot)com, thomas(dot)munro(at)enterprisedb(dot)com
Cc: jeff(dot)janes(at)gmail(dot)com, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Making tab-complete.c easier to maintain
Date: 2015-11-26 05:45:12
Message-ID: 20151126.144512.10228250.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, the attached are a patchset to introduce a special
matching expression which simplifies matching descriptions. The
result looks as if the comments in the previous implement run
as-is.

0001-Allow-regex-module-to-be-used-outside-server.patch

A small patch to allow pg_regex to be used outside backend. The
same with the previous one.

0002-Simplify-the-usages-of-COMPLETE_WITH_QUERY.patch

This is also the same with the previous one.

0003-Replace-previous-matching-rule-with-regexps-take-2.patch

Modifies to use this matching minilang. No bare regular
expression is seen for every matching. The difference from the
previous one is that sources for other than regcomp.o are no
longer symlinked to psql's directory. Compiled regular
expressions are cached until psql ends. The function patcomp is
the central of the messy of this patchset.

This cannot be compiled on Windows, I think.

0004-Remove-less-informative-comments.patch

Remove comments that no longer has reason to be placed there.

0005-Merge-mergable-completions.patch

Merge some of the matchings that are simply mergable by using
this minilang.

What do you think about this solution?

At Tue, 17 Nov 2015 19:25:24 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote in <20151117(dot)192524(dot)95155716(dot)horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
> Hello, I tried to implement the mini-language, which is a
> simplified reglar expression for this specific use.
>
> As a ultra-POC, the attached patch has very ad-hoc preprocess
> function and does on-the-fly preprocessing, compilation then
> execution of regular expression. And it is applied to only the
> first ten or so matchings in psql_completion().
>
> The first attachment is the same with that of previous patchset.
>
> Every matching line looks like the following,
>
> > else if (RM("ALTER {AGGREGATE|FUNCTION} [#id](.."))
> > COMPLETE_WITH_FUNCTION_ARG(CAPTURE(1));

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Allow-regex-module-to-be-used-outside-server.patch text/x-patch 4.3 KB
0002-Simplify-the-usages-of-COMPLETE_WITH_QUERY.patch text/x-patch 29.7 KB
0003-Replace-existing-completions-with-regular-expression.patch text/x-patch 152.5 KB
0004-Remove-less-informative-comments.patch text/x-patch 47.2 KB
0005-Merge-mergable-completions.patch text/x-patch 14.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-11-26 05:55:17 Re: COPY (INSERT/UPDATE/DELETE .. RETURNING ..)
Previous Message Kyotaro HORIGUCHI 2015-11-26 05:19:24 Re: [Proposal] Table partition + join pushdown