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

2019-01-10 Thread Fabien COELHO
Hello Alvaro, There's a lot of the new code in pgbench that can be simplified if we remove \cset. I'm not very happy with the resulting syntax, but IMO the feature is useful. My initial design was to copy PL/pgSQL "into" with some "\into" orthogonal to \; and ;, but the implementation was

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

2019-01-10 Thread Fabien COELHO
Hello Tom, So who needs that? Just merge the queries, if it's so important that you avoid multiple round trips. Pgbench is about testing (measuring) performance in various settings and realistic scenarii: queries prepared or not, possible combined, and so on. As postgres allows to send

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

2019-01-10 Thread Alvaro Herrera
On 2019-Jan-10, Tom Lane wrote: > Alvaro Herrera writes: > > On 2019-Jan-10, Tom Lane wrote: > >> This \cset thing seem like an incredibly badly thought out kluge. > >> What is its excuse to live? > > > The reason is that you can set variables from several queries in one > > network trip. > >

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

2019-01-10 Thread Tom Lane
Alvaro Herrera writes: > On 2019-Jan-10, Tom Lane wrote: >> This \cset thing seem like an incredibly badly thought out kluge. >> What is its excuse to live? > The reason is that you can set variables from several queries in one > network trip. So who needs that? Just merge the queries, if it's

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

2019-01-10 Thread Tom Lane
Alvaro Herrera writes: > Now let's see how the buildfarm likes this ... This \cset thing seem like an incredibly badly thought out kluge. What is its excuse to live? regards, tom lane

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

2019-01-10 Thread Alvaro Herrera
On 2019-Jan-10, Fabien COELHO wrote: > However, I switched "pg_free" to "termPQExpBuffer", which seems more > appropriate, even if it just does the same thing. I also ensured that > prefixes are allocated & freed. I've commented about expr which is not > freed. Oops, of course, thanks. > I'm

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

2019-01-10 Thread Fabien COELHO
Hello Alvaro, Here are my proposed final changes. Thanks again for improving the patch! I noticed that you were allocating the prefixes for all cases even when there were no cset/gset in the command; I changed it to delay the allocation until needed. Ok, why not. I also noticed you

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

2019-01-09 Thread Alvaro Herrera
Here are my proposed final changes. I noticed that you were allocating the prefixes for all cases even when there were no cset/gset in the command; I changed it to delay the allocation until needed. I also noticed you were skipping the Meta enum dance for no good reason; added that makes

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

2019-01-09 Thread Fabien COELHO
Attached v27 is the same but with an improved documentation where full examples, with and without prefix, are provided for both cset & gset. I have already made changes on top of v26. Can you please submit this as a delta patch on top of v26? Attached. -- Fabien.diff --git

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

2019-01-09 Thread Alvaro Herrera
On 2019-Jan-09, Fabien COELHO wrote: > > Attached a v26 with I hope everything ok, but for the documentation that > > I'm unsure how to improve. > > Attached v27 is the same but with an improved documentation where full > examples, with and without prefix, are provided for both cset & gset. I

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

2019-01-08 Thread Fabien COELHO
Attached a v26 with I hope everything ok, but for the documentation that I'm unsure how to improve. Attached v27 is the same but with an improved documentation where full examples, with and without prefix, are provided for both cset & gset. -- Fabien.diff --git

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

2019-01-06 Thread Fabien COELHO
Hello Alvaro, 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. Thanks a lot for having a look a this patch, and improving it. The updated version did not work,

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

2019-01-03 Thread Alvaro Herrera
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

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

2018-11-24 Thread Fabien COELHO
FWIW I think the terminology in this patch is wrong. You use the term "compound" to mean "one query within a string containing multiple queries", but that's not what compound means. Compound is the whole thing, comprised of the multiple queries. Indeed. Compounded query? Maybe "query" is

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

2018-11-24 Thread Alvaro Herrera
FWIW I think the terminology in this patch is wrong. You use the term "compound" to mean "one query within a string containing multiple queries", but that's not what compound means. Compound is the whole thing, comprised of the multiple queries. Maybe "query" is the right word to use there, not

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

2018-11-23 Thread Fabien COELHO
Hello Alvaro, Please when you rebase, consider these (minor) changes. Here it is. -- Fabien.diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml index b5e3a62a33..246944ea79 100644 --- a/doc/src/sgml/ref/pgbench.sgml +++ b/doc/src/sgml/ref/pgbench.sgml @@ -954,6

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

2018-11-21 Thread Alvaro Herrera
On 2018-Nov-18, Fabien COELHO wrote: > Attached a v23 with PQExpBuffer for managing lines. > > I've also added a function to compute the summary first line, which handles > carriage-return. Thanks. Please when you rebase, consider these (minor) changes. -- Álvaro Herrera

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

2018-11-18 Thread Fabien COELHO
Hello Alvaro, I think this patch's Command->lines would benefit from using PQExpBuffer (or maybe StringInfo?) for the command string instead of open-coding string manipulation and allocation. [...] Ok. I'm not sure that Command->first_line is really all that useful. It seems we go to a

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

2018-11-17 Thread Alvaro Herrera
On 2018-Nov-17, Fabien COELHO wrote: > > > I think this patch's Command->lines would benefit from using PQExpBuffer > > (or maybe StringInfo?) for the command string instead of open-coding > > string manipulation and allocation. > > Indeed it could be used, but it is not used anywhere in

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

2018-11-17 Thread Fabien COELHO
I think this patch's Command->lines would benefit from using PQExpBuffer (or maybe StringInfo?) for the command string instead of open-coding string manipulation and allocation. Indeed it could be used, but it is not used anywhere in "pgbench": not for lines, not for variable subtitutions,

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

2018-11-17 Thread Fabien COELHO
Hello Alvaro, Thanks for having a look at this patch. Think of one initialization followed by two appends: SELECT 1 AS x \cset SELECT 2 \; SELECT 3 AS y \cset SELECT 4 \; SELECT 5 \; SELECT 6 AS z \gset In the end, we must have the full 6 queries "SELECT 1 AS x \; SELECT 2 \;

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

2018-11-17 Thread Alvaro Herrera
I think this patch's Command->lines would benefit from using PQExpBuffer (or maybe StringInfo?) for the command string instead of open-coding string manipulation and allocation. I'm not sure that Command->first_line is really all that useful. It seems we go to a lot of trouble to keep it up to

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

2018-11-17 Thread Alvaro Herrera
On 2018-Nov-16, Alvaro Herrera wrote: > On 2017-Nov-04, Fabien COELHO wrote: > > > Think of one initialization followed by two appends: > > > > SELECT 1 AS x \cset > > SELECT 2 \; SELECT 3 AS y \cset > > SELECT 4 \; SELECT 5 \; SELECT 6 AS z \gset > > > > In the end, we must have the

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

2018-11-16 Thread Alvaro Herrera
On 2017-Nov-04, Fabien COELHO wrote: > Think of one initialization followed by two appends: > > SELECT 1 AS x \cset > SELECT 2 \; SELECT 3 AS y \cset > SELECT 4 \; SELECT 5 \; SELECT 6 AS z \gset > > In the end, we must have the full 6 queries > > "SELECT 1 AS x \; SELECT 2 \; SELECT 3

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

2018-10-15 Thread Fabien COELHO
Here is yet another rebase. Here is yet another rebase after Peter's exit status changes on pgbench. Whether Stephen will have time to commit this patch is unclear. I'd suggest that I remove his name from the committer column so that another committer may consider it. What do you think?

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

2018-10-02 Thread Fabien COELHO
Bonjour Michaël, On Tue, Aug 14, 2018 at 01:38:21PM +0200, Fabien COELHO wrote: I re-attached the v19 for a check on the list. You are marked as the committer of this patch in the CF app since last April and this patch is marked as ready for committer. Are you planning to look at it soon?

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

2018-09-12 Thread Michael Paquier
Hi Stephen, On Tue, Aug 14, 2018 at 01:38:21PM +0200, Fabien COELHO wrote: > I re-attached the v19 for a check on the list. You are marked as the committer of this patch in the CF app since last April and this patch is marked as ready for committer. Are you planning to look at it soon? --

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

2018-08-14 Thread Alvaro Herrera
On 2018-Aug-14, Fabien COELHO wrote: > > (At least, that's true with my preferred web browser, maybe it's > > different for other people?) > > So if I send with text/x-diff or text/plain I've got complaints, if I send > with application/octet-stream, it is not right either:-) Everybody being >

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

2018-08-14 Thread Fabien COELHO
I have no doubt that some MUA around would forget to do the conversion. FWIW, one reason that I invariably use patch(1) to apply submitted patches is that it will take care of stripping any CRs that may have snuck in. So I'm not particularly fussed about the problem. Good to know. I'm

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

2018-08-14 Thread Andrew Dunstan
On 08/14/2018 01:44 PM, Tom Lane wrote: Fabien COELHO writes: I have no doubt that some MUA around would forget to do the conversion. FWIW, one reason that I invariably use patch(1) to apply submitted patches is that it will take care of stripping any CRs that may have snuck in. So I'm not

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

2018-08-14 Thread Robert Haas
On Tue, Aug 14, 2018 at 1:44 PM, Tom Lane wrote: > Fabien COELHO writes: >> I have no doubt that some MUA around would forget to do the conversion. > > FWIW, one reason that I invariably use patch(1) to apply submitted patches > is that it will take care of stripping any CRs that may have snuck

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

2018-08-14 Thread Tom Lane
Fabien COELHO writes: > I have no doubt that some MUA around would forget to do the conversion. FWIW, one reason that I invariably use patch(1) to apply submitted patches is that it will take care of stripping any CRs that may have snuck in. So I'm not particularly fussed about the problem. I'm

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

2018-08-14 Thread Fabien COELHO
Hello Andrew, It's not done by my MUA, and it's present in your latest posted patch. If anything I'd suspect your MUA: andrew@emma*$ curl -s https://www.postgresql.org/message-id/attachment/64237/pgbench-into-19.patch Argh. Indeed, this downloaded version has CRLF. Now when I save the

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

2018-08-14 Thread Andrew Gierth
> "Andrew" == Andrew Dunstan writes: >> The patch in the original email is in text/plain with base64 transfer >> encoding, which means that CRLF line endings are mandatory. It's >> actually up to the receiving MUA (or the archives webserver) to undo >> that. >> >> If the archives

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

2018-08-14 Thread Andrew Dunstan
On 08/14/2018 07:37 AM, Andrew Gierth wrote: "Andrew" == Andrew Dunstan writes: >>> This patch contains CRLF line endings >> >> Alas, not according to "file" nor "hexdump" (only 0A, no 0D) on my >> local version, AFAICS. >> >> What happens on the path and what is done by mail

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

2018-08-14 Thread Fabien COELHO
Andrew> It's not done by my MUA, and it's present in your latest posted Andrew> patch. If anything I'd suspect your MUA: The patch in the original email is in text/plain with base64 transfer encoding, which means that CRLF line endings are mandatory. It's actually up to the receiving MUA (or

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

2018-08-14 Thread Andrew Gierth
> "Andrew" == Andrew Dunstan writes: >>> This patch contains CRLF line endings >> >> Alas, not according to "file" nor "hexdump" (only 0A, no 0D) on my >> local version, AFAICS. >> >> What happens on the path and what is done by mail clients depending >> on the mime type is another

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

2018-08-14 Thread Andrew Dunstan
On 08/13/2018 06:30 PM, Fabien COELHO wrote: Hello Andrew, Attached is v18, another basic rebase after some perl automatic reindentation. This patch contains CRLF line endings Alas, not according to "file" nor "hexdump" (only 0A, no 0D) on my local version, AFAICS. What happens on

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

2018-08-13 Thread Fabien COELHO
Hello Andrew, Attached is v18, another basic rebase after some perl automatic reindentation. This patch contains CRLF line endings Alas, not according to "file" nor "hexdump" (only 0A, no 0D) on my local version, AFAICS. What happens on the path and what is done by mail clients

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

2018-08-13 Thread Andrew Dunstan
On 04/27/2018 12:28 PM, Fabien COELHO wrote: Hello Stephen, Attached is v18, another basic rebase after some perl automatic reindentation. This patch contains CRLF line endings - and in any case it doesn't apply any more. Please fix those things. cheers andrew -- Andrew Dunstan

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

2018-04-27 Thread Fabien COELHO
Hello Stephen, Attached is v18, another basic rebase after some perl automatic reindentation. -- Fabien.diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml index e4b37dd..28a1387 100644 --- a/doc/src/sgml/ref/pgbench.sgml +++ b/doc/src/sgml/ref/pgbench.sgml @@ -942,6

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

2018-04-07 Thread Fabien COELHO
Hello Stephen, Might be interesting to support mutli-row (or no row?) returns in the future, but not something this patch needs to do, so this looks fine to me. It could match PL/pgSQL's INTO, that is first row or NULL if none. Yeah, but that's not really something that needs to go into

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

2018-04-07 Thread Stephen Frost
Fabien, * Fabien COELHO (coe...@cri.ensmp.fr) wrote: > >> > >>+ > >>+ > >>+ \cset [prefix] or > >>+ \gset [prefix] > >>+ > > > >Seems like this should really be moved down below the section for > >'\set'. > > Dunno. > > I put them there because it is in alphabetical order

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

2018-04-07 Thread Fabien COELHO
Hello Stephen, Here's that review. Thanks for the review. + + + \cset [prefix] or + \gset [prefix] + Seems like this should really be moved down below the section for '\set'. Dunno. I put them there because it is in alphabetical order (for cset at least) and

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

2018-04-06 Thread Stephen Frost
Fabien, * Fabien COELHO (fabien.coe...@mines-paristech.fr) wrote: > Patch v16 is a rebase. Here's that review. > diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml > index d52d324..203b6bc 100644 > --- a/doc/src/sgml/ref/pgbench.sgml > +++ b/doc/src/sgml/ref/pgbench.sgml

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

2018-04-06 Thread Stephen Frost
Greetings Fabien, * Fabien COELHO (fabien.coe...@mines-paristech.fr) wrote: > >>Here is a v14, after yet another rebase, and some comments added to > >>answer your new comments. > > > >Attached v15 is a simple rebase after Teodor push of new functions & > >operators in pgbench. > > Patch v16 is

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

2018-03-24 Thread Fabien COELHO
Here is a v14, after yet another rebase, and some comments added to answer your new comments. Attached v15 is a simple rebase after Teodor push of new functions & operators in pgbench. Patch v16 is a rebase. -- Fabien.diff --git a/doc/src/sgml/ref/pgbench.sgml

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

2018-01-10 Thread Fabien COELHO
Here is a v14, after yet another rebase, and some comments added to answer your new comments. Attached v15 is a simple rebase after Teodor push of new functions & operators in pgbench. -- Fabien.diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml index

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

2017-11-30 Thread Fabien COELHO
Hello Michaël, Here is a v14, after yet another rebase, and some comments added to answer your new comments. The last patch sent still applies, but its status of "ready for committer" does not look adapted as this version got no reviews. So I am switching back the patch as "needs review".

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

2017-11-30 Thread Michael Paquier
On Sat, Nov 4, 2017 at 8:05 PM, Fabien COELHO wrote: >>> Here is a v13, which is just a rebase after the documentation >>> xml-ization. > > Here is a v14, after yet another rebase, and some comments added to answer > your new comments. The last patch sent still applies, but