Re: [HACKERS] pgbench - allow to store select results into variables

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Stephen Frost <sfrost(at)snowman(dot)net>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] pgbench - allow to store select results into variables
Date: 2019-01-03 17:51:02
Message-ID: 201901031751.h7siijzvd3ve@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I revised this patch a bit. Here's v25, where some finishing touches
are needed -- see below. I think with these changes the patch would
become committable, at least for me.

I didn't like that you were adding an #include of psqlscan_int.h into
pgbench.c, when there's a specific comment in the header saying not to
do that, so I opted for adding a new accessor function on psqlscan.h.

I renamed some of your parameter additions. I think the new names are
clearer, but they meant the +1's in your code are now in illogical
places. (I moved some; probably not enough). Please review/fix that.

I think "gset" is not a great name for the new struct member; please
find a better name. I suggest "targetvar" but feel free to choose a
name that suits your taste.

There are two XXX comments. One is about a function needing a comment
atop it. The other is about realloc behavior. To fix this one I would
add a new struct member indicating the allocated size of the array, then
growing exponentially instead of one at a time. For most cases you can
probably get away with never reallocating beyond an initial allocation
of, say, 8 members.

In the docs, the [prefix] part needs to be explained in the \cset entry;
right now it's in \gset, which comes afterwards. Let's move the
explanation up, and then in \gset say "prefix behaves as in \cset".


Álvaro Herrera
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
pgbench-into-25.patch text/x-diff 29.8 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-01-03 17:52:10 Re: Python versions (was Re: RHEL 8.0 build)
Previous Message Andrew Alsup 2019-01-03 17:39:02 Re: SQL/JSON: functions