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

From Fabien COELHO
Subject Re: extend pgbench expressions with functions
Date
Msg-id alpine.DEB.2.10.1603090822170.25393@sto
Whole thread Raw
In response to Re: extend pgbench expressions with functions  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: extend pgbench expressions with functions
List pgsql-hackers
Hello Robert,

Here is a v35 b & c.

> This is not acceptable:
>
> +                               /* guess double type (n for "inf",
> "-inf" and "nan") */
> +                               if (strchr(var, '.') != NULL ||
> strchr(var, 'n') != NULL)
> +                               {
> +                                       double dv;
> +                                       sscanf(var, "%lf", &dv);
> +                                       setDoubleValue(retval, dv);
> +                               }
> +                               else
> +                                       setIntValue(retval, strtoint64(var));
>
> That totally breaks the error handling which someone carefully established here.

I'm not sure what is "not acceptable" as it "totally breaks the error 
handling" in the above code.

I assumed that you want to check that sscanf can read what sprintf 
generated when handling "\set". I'd guess that libc would be broken if it 
was the case. I've made pgbench check that it is not.

If it was something else, you have to spell it out for me.

> Extra space. [...] Another extra space.

Indeed.

> -       int                     nargs = 0;
> -       int64           iargs[MAX_FARGS];
> -       PgBenchExprLink *l = args;
> +       int                                     nargs = 0;
> +       PgBenchValue            vargs[MAX_FARGS];
> +       PgBenchExprLink    *l = args;
>
> Completely unnecessary reindentation of the first and third lines.

It just looked better to me.

> +                                       setIntValue(retval, i < 0? -i: i);
>
> Not project style.

Indeed.

> Please fix the whitespace damage git diff --check complains about,

"git diff -check" does not seem to complain on the full v35-b.

> and check for other places where you haven't followed project style.

I've found some more instances of "& ref".

-- 
Fabien.

pgsql-hackers by date:

Previous
From:
Date:
Subject: Re: [PROPOSAL] VACUUM Progress Checker.
Next
From: Etsuro Fujita
Date:
Subject: Re: Minor documentation tweak to GetForeignPlan documentation