On Tue, Nov 5, 2024 at 6:50 AM Michael Paquier <mich...@paquier.xyz> wrote: > It would be nice to document all these behaviors with regression > tests in pgbench as it is the only place where we can control that > with error pattern checks. It's not the first time I wanted to be able to do pipelining in psql as relying on pgbench and tap tests is not the most flexible so I took a stab at adding it.
0001: This is a small bug I've stumbled upon. The query buffer is not cleared on a backslash error. For example, "SELECT 1 \parse" would fail due to a missing statement name but would leave "SELECT 1\n" in the query buffer which would impact the next command. 0002: This adds pipeline support to psql by adding the same meta-commands as pgbench: \startpipeline, \endpipeline and \syncpipeline. Once a pipeline is started, all extended protocol queries are piped until \endpipeline is called. To keep things simple, meta-commands like \gx, \gdesc and \gexec are forbidden inside a pipeline. The tests are covering the existing pipelining behaviour with the SET LOCAL, SAVEPOINTS, REINDEX CONCURRENTLY and LOCK commands, depending if it's the first command or not. The \syncpipeline allows us to see that this "first command" behaviour also happens after a synchronisation point within a pipeline. 0003: The initial change to use implicit transaction block when pipelining is detected. The tests reflect the change in behaviour like the LOCK command working if it's the second command in the pipeline. I've updated the pipeline documentation to provide more details about the use of implicit transaction blocks with pipelines.
v03-0001-Reset-query-buffer-on-a-backslash-error.patch
Description: Binary data
v03-0003-Consider-pipeline-implicit-transaction-as-a-tran.patch
Description: Binary data
v03-0002-Add-pipeline-support-in-psql.patch
Description: Binary data