Skip to content

Fix multi-level nested scalar subquery evaluation - #2550

Merged
mathiasrw merged 3 commits into
developfrom
copilot/fix-third-level-subquery-error
Sep 29, 2026
Merged

mathiasrw merged 3 commits into
developfrom
copilot/fix-third-level-subquery-error

Conversation

Copilot AI commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Nested scalar subqueries deeper than two levels failed at runtime because inner selects resolved queriesidx against a missing queriesfn.

Changes

  • compileQueries: share the compiled subquery list down the tree so multi-level scalar selects can resolve this.queriesfn[queriesidx - 1]
  • Nested IN path: avoid overwriting a queriesfn already built during nested compile()
  • test/test1025.js: regression coverage for 2–4 level scalar nesting, derived tables, and nested scalars inside IN

Example

-- previously threw: Cannot read properties of undefined (reading '0')
SELECT (SELECT (SELECT 1 AS c) AS b) AS a;
-- => [{ a: 1 }]

Copilot AI linked an issue Sep 10, 2026 that may be closed by this pull request
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.

Third level of subquery result in error

2 participants