Re: add modulo (%) operator to pgbench - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: add modulo (%) operator to pgbench
Date
Msg-id alpine.DEB.2.10.1501051856160.764@sto
Whole thread Raw
In response to Re: add modulo (%) operator to pgbench  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Hello Alvaro,

Here is a v6 with most of your suggestions applied.

> On top of evaluateExpr() we need a comment (generally I think pgbench
> could do with more comments; not saying your patch should add them, just
> expressing an opinion.)  Also, intuitively I would say that the return
> values of that function should be reversed: return true if things are
> good.

Comment & inverted return value done.

> I wonder about LOCATE and LOCATION.  Can we do away with the latter, and
> keep only LOCATE perhaps with a better name such as PRINT_ERROR_AT or
> similar?  I would just expand an ad-hoc fprintf in the single place
> where the other macro is used.

I've used just one PRINT_ERROR_AT() macro consistently.

> Are we okay with only integer operands?  Is this something we would
> expand in the future?  Is the gaussian/exp random stuff going to work
> with integer operands, if we want to change it to use function syntax,
> as expressed elsewhere?

Nothing for now, I feel it is for a later round.

> [other mail] bring ERROR() macro back

I also prefer the code with it, but the cost-benefit of a pre-C99 
compatible implementation seems quite low, and it does imply less (style) 
changes with the previous situation as it is.

-- 
Fabien.

pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Redesigning checkpoint_segments
Next
From: Atri Sharma
Date:
Subject: Re: Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs