psql: Allow queries terminated by semicolons while in pipeline mode Currently, the only way to pipe queries in an ongoing pipeline (in a \startpipeline block) is to leverage the meta-commands able to create extended queries such as \bind, \parse or \bind_named.
While this is good enough for testing the backend with pipelines, it has been mentioned that it can also be very useful to allow queries terminated by semicolons to be appended to a pipeline. For example, it would be possible to migrate existing psql scripts to use pipelines by just adding a set of \startpipeline and \endpipeline meta-commands, making such scripts more efficient. Doing such a change is proving to be simple in psql: queries terminated by semicolons can be executed through PQsendQueryParams() without any parameters set when the pipeline mode is active, instead of PQsendQuery(), the default, like pgbench. \watch is still forbidden while in a pipeline, as it expects its results to be processed synchronously. The large portion of this commit consists in providing more test coverage, with mixes of extended queries appended in a pipeline by \bind and friends, and queries terminated by semicolons. This improvement has been suggested by Daniel Vérité. Author: Anthonin Bonnefoy <anthonin.bonne...@datadoghq.com> Discussion: https://postgr.es/m/d67b9c19-d009-4a50-8020-1a0ea9236...@manitou-mail.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/2cce0fe440fb3f252a7be70a89298168009a2c15 Modified Files -------------- doc/src/sgml/ref/psql-ref.sgml | 27 ++- src/bin/psql/command.c | 7 + src/bin/psql/common.c | 10 +- src/test/regress/expected/psql_pipeline.out | 252 +++++++++++++++++++++++++--- src/test/regress/sql/psql_pipeline.sql | 110 ++++++++++-- 5 files changed, 359 insertions(+), 47 deletions(-)