Re: Poorly-thought-out handling of double variables in pgbench

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: Poorly-thought-out handling of double variables in pgbench
Дата
Msg-id alpine.DEB.2.10.1605061832210.22692@sto
обсуждение исходный текст
Ответ на Re: Poorly-thought-out handling of double variables in pgbench  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Poorly-thought-out handling of double variables in pgbench  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-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.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Daniel Verite"
Дата:
Сообщение: Re: \crosstabview fixes
Следующее
От: Oleksandr Shulgin
Дата:
Сообщение: Re: Stopping logical replication protocol