Re: Re: [PATCH] Tab completion for ALTER DATABASE … SET TABLESPACE - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Re: [PATCH] Tab completion for ALTER DATABASE … SET TABLESPACE
Date
Msg-id 6546.1537561242@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Tab completion for ALTER DATABASE … SET TABLESPACE  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: [PATCH] Tab completion for ALTER DATABASE … SET TABLESPACE  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Fri, Sep 21, 2018 at 5:52 PM Andres Freund <andres@anarazel.de> wrote:
>> Here's a very quick-and-dirty implementation of this approach. Some very
>> very brief testing seems to indicate it works, although I'm sure not
>> perfectly.

> And here is a quick-and-dirty variadic COMPLETE_WITH(...).  Together:

I'm a bit inclined to get rid of the need for PP_NARG() by instead making
the macros add a trailing NULL argument, viz

#define TailMatches(...) \
  CheckTailMatchesFor(previous_words_count, previous_words, __VA_ARGS__, NULL)

This'd require (some of) the implementation functions to iterate over
their variadic arguments twice, the first time merely counting how many
there are.  But we aren't exactly concerned about max runtime performance
here, and the PP_NARG() thing seems like a crock that could easily blow
out compilation time on some compilers.

If people are OK with that design decision, I'm happy to assemble these
pieces and push it through.  I just had to add two more versions of
HeadMatchesN :-( so I'm feeling motivated to make something happen.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Redundant psql tab-completion for CREATE PUBLICATION
Next
From: Andres Freund
Date:
Subject: Re: [PATCH] Tab completion for ALTER DATABASE … SET TABLESPACE