Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aOCsI-0005Au-CQ for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Jan 2016 23:18:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aOCsG-0002NA-Tx for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Jan 2016 23:18:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aOCsE-0002MR-Hh for pgsql-hackers@postgresql.org; Tue, 26 Jan 2016 23:18:10 +0000 Received: from out.smtp-auth.no-ip.com ([8.23.224.60]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aOCs9-0001vD-AR for pgsql-hackers@postgresql.org; Tue, 26 Jan 2016 23:18:09 +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 [212.76.254.194]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 3B67240158B; Tue, 26 Jan 2016 15:17:57 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 8E0FE5ED; Tue, 26 Jan 2016 20:17:55 -0300 (CLT) Date: Wed, 27 Jan 2016 00:17:55 +0100 From: Alvaro Herrera To: Fabien COELHO Cc: "pgsql-hackers@postgresql.org" Subject: Re: pgbench stats per script & other stuff Message-ID: <20160126231755.GA580522@alvherre.pgsql> 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: -1.1 (-) 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 Fabien COELHO wrote: > a) add -b option for cumulating builtins and rework internal script > management so that builtin and external scripts are managed the > same way. I'm uncomfortable with the prefix-matching aspect of -b. It makes "-b s" ambiguous -- whether it stands for select-only or simple-update is merely a matter of what comes earlier in the table, which doesn't seem reasonable to me. I'd rather have a real way to reject ambiguous cases, or simply accept only complete spellings. This is the guilty party: > +static char * > +find_builtin(const char *name, char **desc) > +{ > + int len = strlen(name), i; > + > + for (i = 0; i < N_BUILTIN; i++) > + { > + if (strncmp(builtin_script[i].name, name, len) == 0) > + { > + *desc = builtin_script[i].desc; > + return builtin_script[i].script; > + } > + } I'm going to change this to use strlen(builtin_script[i].name) instead of "len" here. If you want to implement real non-ambiguous-prefix code (i.e. have "se" for "select-only", but reject "s" as ambiguous) be my guest. -- Á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