Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZYwu7-0007Vh-Au for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Sep 2015 13:56:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZYwu6-0004cA-TA for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Sep 2015 13:56:14 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZYwu5-0004Yd-9t for pgsql-hackers@postgresql.org; Mon, 07 Sep 2015 13:56:13 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZYwu2-0005iR-7L for pgsql-hackers@postgresql.org; Mon, 07 Sep 2015 13:56:12 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [186.37.82.172]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id B5D95400886; Mon, 7 Sep 2015 06:56:08 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id DB82FE7A; Mon, 7 Sep 2015 10:56:05 -0300 (CLT) Date: Mon, 7 Sep 2015 10:56:05 -0300 From: Alvaro Herrera To: Thomas Munro Cc: Tom Lane , Pg Hackers Subject: Re: Making tab-complete.c easier to maintain Message-ID: <20150907135605.GP2912@alvherre.pgsql> References: <17081.1441374043@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Thomas Munro wrote: > Thanks, good point. Here's a version that uses NULL via a macro ANY. > Aside from a few corrections it also now distinguishes between > TAIL_MATCHESn (common) and MATCHESn (rarely used for now), for example: This looks pretty neat -- 100x neater than what we have, at any rate. I would use your new MATCHESn() macros a bit more -- for instance the completion for "ALTER but not ALTER after ALTER TABLE" could be rephrased as simply MATCHES1("ALTER"), i.e. have it match at start of command only. Maybe that's just a matter of going over the new code after the initial run, so that we can have a first patch that's mostly mechanical and a second pass in which more semantically relevant changes are applied. Seems easier to review ... I would use "ANY" as a keyword here. Sounds way too generic to me. Maybe "CompleteAny" or something like that. Stylistically, I find there's too much uppercasing here. Maybe rename the macros like this instead: > + else if (TailMatches4("ALL", "IN", "TABLESPACE", ANY)) > + CompleteWithList2("SET TABLESPACE", "OWNED BY"); Not totally sure about this part TBH. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers