Skip to content

Run a part of a set operation as a recordset whatever modifier it has, to close #3193 - #3209

Open
arsalankhan786777 wants to merge 1 commit into
AlaSQL:mainfrom
arsalankhan786777:fix/3193-union-modifier
Open

arsalankhan786777 wants to merge 1 commit into
AlaSQL:mainfrom
arsalankhan786777:fix/3193-union-modifier

Conversation

@arsalankhan786777

Copy link
Copy Markdown
Contributor

SELECT a FROM A UNION ALL SELECT VALUE a FROM C (and ROW, COLUMN, MATRIX, INDEX, TEXTSTRING) threw TypeError: Cannot read properties of undefined (reading 'length'). A part of a set operation without a modifier is run as a recordset, but a part with its own modifier kept it, so it returned a bare value and the code that copies its rows read nd.data.length of undefined.

as() in src/select/queryfn.js now gives the run of every part the recordset modifier, as a set operation needs rows. The modifier is ignored there, as the issue suggests.

Fixes #3193

Tested:

  • New test/test3193.js (8 tests): UNION ALL with each of the six modifiers, the parenthesised COLUMN ... LIMIT 1 form, and UNION, EXCEPT and INTERSECT with VALUE (compared with the same query without the modifier). The six UNION ALL modifier tests fail before the change; all 8 pass after. I did not check the UNION, EXCEPT and INTERSECT tests separately before the change.
  • Full bun test --preload ./test/bun-setup.js ./test/test[0-9]*.js ./test/test-*.js: 9 failures (Excel 107-B, 2 CLI piped-input tests), the same 9 on unchanged main.
  • prettier --list-different on the two files: clean.

Written with Claude Code (AI); tested locally with bun 1.4.2 (bun test on the built dist) and prettier

🤖 Generated with Claude Code

SELECT VALUE, ROW, COLUMN, MATRIX, INDEX or TEXTSTRING in a later SELECT
of UNION, UNION ALL, EXCEPT or INTERSECT threw a TypeError, because the
part kept its modifier and returned no rows to copy. The part now always
runs as a recordset.

Fixes AlaSQL#3193

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

VALUE, ROW, COLUMN, MATRIX, INDEX or TEXTSTRING in a later SELECT of a set operation throws a TypeError

1 participant