Hi Tomas, Thank you for reporting the issue and the patch. I tested v1 on master (0dbe240dc0e). Both reproducers show the problem on master and are fixed with 0001+0002, make check and the isolation suite pass.
+1 to Ayush's suggestion of also checking QueryCancelPending in enable_statement_timeout(). 0001 resets the indicator in most cases, but an Execute that ends in PortalSuspended doesn't go through disable_statement_timeout(), so a stale indicator could still reach the next statement in the same pipeline (before Sync). For example, a CALL with an INOUT parameter that does COMMIT, executed with max_rows = 1, where statement_timeout fires during the sync rep wait (which clears QueryCancelPending but not the indicator). It's a narrow case, and the extra check seems cheap. Regards, Surya Poondla
