Fix CONTINUE statement in plpgsql FOR ... IN ... SELECT loops and integer FOR loops. - #3238
Conversation
CONTINUE resolved to the first operation inside the enclosing loop's scope, which for an integer FOR loop is the assignment of its lower bound, so CONTINUE restarted the loop instead of advancing it and never terminated. A loop now records its next-iteration operation on its ScopeBegin operation, and reconcileLabels resolves both bare and labelled CONTINUE statements through it, leaving WHILE and plain LOOP on the target that is already correct for them. The integer FOR loop's increment moves ahead of its condition test so that one operation both advances the loop and falls into that test.
CONTINUE resolved to the ForQueryInit that runs the query and fills the cursor, so it re-ran the query and reset the cursor instead of fetching the next row, and never terminated. It now targets the ForQueryNext that advances the cursor.
|
|
SummaryCoverage spans core database loop behavior, including forward and reverse counting, conditional skips, nested and labeled control flow, cursor exhaustion, boundary handling, malformed constructs, and recovery after errors. Happy paths and edge cases behave normally, while invalid scalar targets and unsafe loop-step values expose pre-existing robustness gaps. Safe to merge — neither observed failure is attributable to this PR, and no regression, new failure, or previously flagged unresolved failure was found. The unrelated issues are important follow-up defects, including a medium-impact hang risk, but they are not merge blockers for this change. Tests run by ItoAdditional Findings DetailsThese findings are unrelated to the current changes but were observed during testing. 🟡 Scalar loop targets fail during iteration
Evidence Package🟡 Invalid loop steps can hang the database
Evidence PackageTip Reply with @itoqa to send us feedback on this test run. |
|
@reltuk DOLT
|

No description provided.