Skip to content

Handle empty CTE body in with_queries#662

Closed
santhreal wants to merge 4 commits into
macbre:masterfrom
santhreal:fix/empty-cte-body-attributeerror
Closed

Handle empty CTE body in with_queries#662
santhreal wants to merge 4 commits into
macbre:masterfrom
santhreal:fix/empty-cte-body-attributeerror

Conversation

@santhreal

Copy link
Copy Markdown

NestedQueryResolver._body_sql / with_queries hits AttributeError when WITH a AS () SELECT 1. This PR fixes the regression with a focused test covering the case. claimed

WITH a AS () leaves cte.this as None; calling _body_sql on it raised
AttributeError. Treat an empty body as an empty SQL string.
Share empty-body handling between extract_cte_bodies and the subquery
walker instead of a loop-local continue.
Empty CTE bodies re-fed into Parser("") asserted in _require_ast when
resolving columns. Skip blank definitions at the nested-parser boundary.
Cover sibling star resolution and qualified a.*/a.x so either empty-body
guard deletion turns the suite red.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant