Re: pgbench stats per script & other stuff - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: pgbench stats per script & other stuff
Date
Msg-id alpine.DEB.2.10.1603041921320.11128@sto
Whole thread Raw
In response to Re: pgbench stats per script & other stuff  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: pgbench stats per script & other stuff
List pgsql-hackers
>>   *-21.patch does what you suggested above, some hidden awkwardness
>>      but much less that the previous one.
>
> Yeah, I think this is much nicer, don't you agree?

Yep, I said "less awkwarness than previous", a pretty contrived way to say 
better:-)

> However, this is still a bit broken -- you cannot return a stack
> variable from process_file, because the stack goes away once the
> function returns.  You need to malloc it.

That is why the "fs" variable in process_file is declared "static", and 
why I wrote "some hidden awkwarness".

I did want to avoid a malloc because then who would free the struct? 
addScript cannot to it systematically because builtins are static. Or it 
would have to create an on purpose struct, but I then that would be more 
awkwarness, and malloc/free to pass arguments between functions is not 
efficient nor very elegant.

So the "static" option looked like the simplest & most elegant version.

> Also, you forgot to update the comments in process_file,
> process_builtin, etc.

Indeed. v22 attached with better comments.

-- 
Fabien.

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: More stable query plans via more predictable column statistics
Next
From: Alvaro Herrera
Date:
Subject: Re: pgbench stats per script & other stuff