Re: Add Pipelining support in psql
Daniel Verite <daniel@manitou-mail.org>
Anthonin Bonnefoy wrote: > Another possible option would be to directly send the command without > requiring an additional meta-command, like "SELECT 1 \bind". However, > this would make it more painful to introduce new parameters, plus it > makes the \bind and \bind_named inconsistent as it is normally > required to send the result with a separate meta-command. AFAIU the reason why \bind is required (even when there are no $N parameters in the query) is to trigger the use of the extended query protocol. This pre-dates the pipeline feature. But when in a pipeline, we can't send queries with the simple query protocol anyway, so a possible usability improvement would be to make \bind optional in that case. Concretely it's not possible currently to issue: \startpipeline select 1; it causes the error: "PQsendQuery not allowed in pipeline mode" whereas this sequence does works: \startpipeline \bind select 1; \flushrequest \getresults But if the code triggered the use of the extended query protocol if \bind is in effect *or* a pipeline is active, then the first sequence would just push "select 1" into the pipeline. This would have the advantage that, to submit into a pipeline a pre-existing file with SQL commands separated with ";" you don't have to pre-process it to inject metacommands. Adding a \startpipeline at the beginning and an \endpipeline at the end would be sufficient in the cases that the user does not need the results before the end. The \sendpipeline is not mandatory when ";" can be used to terminate the queries. But it makes it clearer that the script wants specifically to push into a pipeline, and it might accept specific options in the future, whereas obviously ";" cannot. Best regards, -- Daniel Vérité https://postgresql.verite.pro/
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
psql: Fix assertion failures with pipeline mode
- 3631612eae9c 18.0 landed
-
psql: Rework TAP routine psql_fails_like() to define WAL sender context
- 0ff95e0a5be1 18.0 landed
-
psql: Split extended query protocol meta-commands in --help=commands
- 78231baaf967 18.0 landed
-
psql: Improve descriptions of \\flush[request] in --help
- 5743d122fcf3 18.0 landed
-
psql: Fix incorrect status code returned by \getresults
- 5ee7bd944ee8 18.0 landed
-
psql: Allow queries terminated by semicolons while in pipeline mode
- 2cce0fe440fb 18.0 landed
-
psql: Add \sendpipeline to send query buffers while in a pipeline
- 17caf6644546 18.0 landed
-
psql: Fix memory leak with \gx used within a pipeline
- 54d23601b978 18.0 landed
-
psql: Add pipeline status to prompt and some state variables
- 3ce357584e79 18.0 landed
-
Add more tests for utility commands in pipelines
- a4e986ef5a46 18.0 landed
-
psql: Add support for pipelines
- 41625ab8ea3d 18.0 landed
-
Add braces for if block with large comment in psql's common.c
- 40af897eb777 18.0 landed