From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Developers <pgsql-hackers@postgreSQL.org>
Subject: Re: Poorly-thought-out handling of double variables in pgbench
Date: Fri, 6 May 2016 18:42:58 +0200 (CEST)
Message-ID: <alpine.DEB.2.10.1605061832210.22692@sto> (raw)
In-Reply-To: <16451.1462547620@sss.pgh.pa.us>
References: <9188.1462475559@sss.pgh.pa.us>
<alpine.DEB.2.10.1605052126560.30701@sto>
<15599.1462484702@sss.pgh.pa.us>
<alpine.DEB.2.10.1605060842120.30701@sto>
<16451.1462547620@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
>> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: coelho@cri.ensmp.fr, tgl@sss.pgh.pa.us
Subject: Re: Poorly-thought-out handling of double variables in pgbench
In-Reply-To: <alpine.DEB.2.10.1605061832210.22692@sto>
References: <9188.1462475559@sss.pgh.pa.us> <alpine.DEB.2.10.1605052126560.30701@sto> <15599.1462484702@sss.pgh.pa.us> <alpine.DEB.2.10.1605060842120.30701@sto> <16451.1462547620@sss.pgh.pa.us> <alpine.DEB.2.10.1605061832210.22692@sto>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox