Re: extend pgbench expressions with functions - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: extend pgbench expressions with functions
Date
Msg-id CAB7nPqScEj-Uwq8kWLui7uMyyaTGu=G3mLYyVZPW-c5NELp_ew@mail.gmail.com
Whole thread Raw
In response to Re: extend pgbench expressions with functions  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: extend pgbench expressions with functions
List pgsql-hackers
On Thu, Jan 14, 2016 at 5:54 PM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:
> I wrote:
>> -                 fprintf(stderr, "gaussian parameter must be at least
>> %f (not \"%s\")\n", MIN_GAUSSIAN_PARAM, argv[5]);
>> +                fprintf(stderr,
>> +                           "random gaussian parameter must be greater
>> than %f "
>> +                            "(got %f)\n", MIN_GAUSSIAN_PARAM, parameter);
>> This looks like useless noise to me. Why changing those messages?
>
>
> Because the message was not saying that it was about random, and I think
> that it is the important.
>>              fprintf(stderr,
>> -                       "exponential parameter must be greater than
>> zero (not \"%s\")\n",
>> -                        argv[5]);
>> +                      "random exponential parameter must be greater than
>> 0.0 "
>> +                       "(got %f)\n", parameter);
>>              st->ecnt++;
>> -            return true;
>> +           return false;
>> This diff is noise as well, and should be removed.
>
> Ok, I can but "zero" and "not" back, but same remark as above, why not tell
> that it is about random? This information is missing.

Those things should be a separate patch then, committed separately as
they provide more verbose messages.

>> +               /*
>> +                * Note: this section could be removed, as the same
>> functionnality
>> +                * is available through \set xxx random_gaussian(...)
>> +                */
>> I think that you are right to do that. That's no fun to break existing
>> scripts, even if people doing that with pgbench are surely experienced
>> hackers.
>
> Ok, but I would like a clear go or vote before doing this.

For now, I am seeing opinions on those matters from nobody else than
me and you, and we got toward the same direction. If you think that
there is a possibility that somebody has a different opinion on those
matters, and it is likely so let's keep the patch as-is then and wait
for more input: it is easier to remove code than add it back. I am not
sure what a committer would say, and it surely would be a waste of
time to just move back and worth for everybody.

>> int() should be strengthened regarding bounds. For example:
>> \set cid debug(int(int(9223372036854775807) +
>> double(9223372036854775807)))
>> debug(script=0,command=1): int -9223372036854775808
>
>
> Hmmm. You mean just to check the double -> int conversion for overflow,
> as in:
>
>   SELECT (9223372036854775807::INT8 +
>           9223372036854775807::DOUBLE PRECISION)::INT8;
>
> Ok.

Yes, that's what I mean. The job running into that should definitely
fail with a proper out-of-bound error message.
-- 
Michael



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: About get_relation_constraints and include_notnull
Next
From: Tatsuro Yamada
Date:
Subject: Comment typo in port/atomics/generic.h