Re: [HACKERS] pgbench - allow to store select results into variables
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Michael Paquier <michael@paquier.xyz>, Stephen Frost <sfrost@snowman.net>,
Andrew Dunstan <andrew.dunstan@2ndquadrant.com>,
PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2018-11-18T10:23:08Z
Lists: pgsql-hackers
Attachments
- pgbench-into-23.patch (text/x-diff) patch
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 lot of trouble to keep it up to date. Isn't it easier >>> to chop Command->lines at the first newline when it is needed? >> >> Hmmm, it is needed quite often (about 12 times) to report errors, that would >> mean having to handle the truncation in many places, so I felt it was worth >> the trouble. > > Ok, as long as we don't repeat the work during script execution. Sure, the point of first_line is that it is computed once at parse time. Attached a v23 with PQExpBuffer for managing lines. I've also added a function to compute the summary first line, which handles carriage-return. -- 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