Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ayiqR-0005CJ-OH for pgsql-hackers@arkaria.postgresql.org; Fri, 06 May 2016 16:43:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ayiqR-00037Z-5N for pgsql-hackers@arkaria.postgresql.org; Fri, 06 May 2016 16:43:15 +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_2) (envelope-from ) id 1ayiqP-00035w-7S for pgsql-hackers@postgreSQL.org; Fri, 06 May 2016 16:43:13 +0000 Received: from boipeva.ensmp.fr ([194.214.158.136]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ayiqM-0006HN-Ev for pgsql-hackers@postgreSQL.org; Fri, 06 May 2016 16:43:12 +0000 Received: from cri.ensmp.fr (102.43.15.109.rev.sfr.net [109.15.43.102]) (authenticated bits=0) by boipeva.ensmp.fr (8.15.2/8.15.1/JMMC-22/Oct/2013) with ESMTPSA id u46GgwYR029967 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 6 May 2016 18:43:05 +0200 Date: Fri, 6 May 2016 18:42:58 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@sto To: Tom Lane cc: PostgreSQL Developers Subject: Re: Poorly-thought-out handling of double variables in pgbench In-Reply-To: <16451.1462547620@sss.pgh.pa.us> Message-ID: References: <9188.1462475559@sss.pgh.pa.us> <15599.1462484702@sss.pgh.pa.us> <16451.1462547620@sss.pgh.pa.us> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at boipeva.ensmp.fr with ID 572CC992.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Auth: USER-ID fabien.coelho X-j-chkmail-Enveloppe: 572CC992.000 from 102.43.15.109.rev.sfr.net/102.43.15.109.rev.sfr.net/109.15.43.102/cri.ensmp.fr/ X-Pg-Spam-Score: -4.0 (----) 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 >> While testing the patch I found a minor preexisting (mine...) bug: when >> string-scanning doubles, whether the whole string is consumed or not is >> not checked. This means that -D x=0one is interpreted as double 0. > >> I came up with the attached check, but maybe there is a cleaner way to do >> that. > > I like the way the zic code does it: > + char xs; > ! if (sscanf(var->value, "%lf%c", &dv, &xs) != 1) Indeed... I cannot say that it is cleaner such, but at least it is short and it avoids the strlen call. > Neither way allows for trailing whitespace, though. I don't see that > that's important here. No, this is not an issue here for variables specified from the command line. Consider pushing this fix? -- Fabien. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers