Re: pgbench - allow to store select results into variables - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: pgbench - allow to store select results into variables
Date
Msg-id alpine.DEB.2.20.1607132140100.26777@sto
Whole thread Raw
In response to Re: pgbench - allow to store select results into variables  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: pgbench - allow to store select results into variables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hello Robert,

> I agree: I like \into.

Great!

> But:
>
>> SELECT 1, 2 \; SELECT 3;
>>  \into one two three
>
> I think that's pretty weird.

I agree that it is weird, but I do not think that it is bad.

Sending a batch of requests is a feature of libpq which is accessible 
through pgbench by using "\;", although the fact is not documented. It 
makes sense for a client to send independent queries together so as to 
reduce latency.

From pgbench perspective, I would find it pretty weird as well that one 
can send several queries together but could only read the answer from... 
say the first one, and the others would be lost.

From an implementation perspective doing it is straightforward, and 
rejecting it would require some more logic.

An obvious nicer feature would be to allow intermixing \into & \; but ISTM 
that it would require to rethink deeply pgbench lexing/parsing which has 
just been merged with psql by Tom and others...

If I had not pointed out the fact that it works, maybe no one would have 
noticed... so a compromise could be not to advertise the fact that it 
works (as the \; feature is not advertised anyway), but letting the 
implementation do it because it is simple and may be useful, and rephrase 
the documentation so that it is just about the previous select and not 
previous select*S*?

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgbench - allow to store select results into variables
Next
From: Tom Lane
Date:
Subject: Re: sslmode=require fallback