Before entering a transaction on a connection in pipeline mode, we open an
outer pipeline to ensure that a Sync is after the transaction exists;
similarly to the inner pipeline, this is to ensure that the connection
state is restored at transaction exit similarly to the non-pipeline
case. The inner pipeline is not enough because we need to account for
the exit transaction statement (COMMIT or ROLLBACK) and then sync its
result.
This fixes transactions tests failing in previous commit.
tx = Transaction(self, savepoint_name, force_rollback)
if self._pipeline:
self._pipeline.sync()
- with tx, self.pipeline():
+ with self.pipeline(), tx, self.pipeline():
yield tx
else:
with tx:
tx = AsyncTransaction(self, savepoint_name, force_rollback)
if self._pipeline:
await self._pipeline.sync()
- async with tx, self.pipeline():
+ async with self.pipeline(), tx, self.pipeline():
yield tx
else:
async with tx: