Re: pgbench - allow to store select results into variables
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>,
PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2016-07-13T20:16:25Z
Lists: 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.
Commits
-
pgbench: Remove \cset
- 25ee70511ec2 12.0 landed
-
pgbench: add \cset and \gset commands
- 6260cc550b0e 12.0 landed
-
Adjust pgbench to allow non-ASCII characters in variable names.
- 9d36a386608d 11.0 landed
-
Refactor script execution state machine in pgbench.
- 12788ae49e19 10.0 cited
-
Allow empty queries in pgbench.
- 6471045230f5 10.0 cited