Hi, When using pipelining with implicit transaction, a transaction will start from the first command and be committed with the Sync message. Functions like IsInTransactionBlock and PreventInTransactionBlock already assimilate this implicit transaction as a transaction block, relying on the XACT_FLAGS_PIPELINING flag. However, this is not the case in CheckTransactionBlock. This function is used for things like warning when a local GUC is set outside of a transaction block.
The attached patch adds the detection of implicit transactions started by a pipeline in CheckTransactionBlock, avoiding warnings when commands like `set local` are called within a pipeline, and making the detection of transaction block coherent with what's done in IsInTransactionBlock and PreventInTransactionBlock. One thing that's still not fixed by the patch is that the first command won't be seen as part of a transaction block. For example, with pgbench: \startpipeline SET LOCAL statement_timeout='200ms'; SELECT * FROM pgbench_accounts where aid=1; \endpipeline The XACT_FLAGS_PIPELINING will only be set after the first command, so the warning about `set local` happening outside of a transaction block will still be generated. However, I'm not sure if it's something fixable (or worth fixing?). This would require to know beforehand that there are multiple executes before the sync message, which doesn't seem doable. Regards, Anthonin
v01-0001-Consider-pipeline-implicit-transaction-as-a-tran.patch
Description: Binary data