Skip to content

Let ORDER BY ... COLLATE NOCASE sort numbers instead of throwing - #2719

Merged
mathiasrw merged 1 commit into
developfrom
fix/nocase-numbers
Oct 20, 2026
Merged

mathiasrw merged 1 commit into
developfrom
fix/nocase-numbers

Conversation

@mathiasrw

Copy link
Copy Markdown
Member

ORDER BY v COLLATE NOCASE called .toUpperCase() on every value, so a number (or a date, or true) threw:

alasql('SELECT v FROM ? ORDER BY v COLLATE NOCASE', [[{v: 10}, {v: 2}]]);
// was: TypeError: (a.$$$0 || "").valueOf(...).toUpperCase is not a function

NOCASE now upper-cases text only; other values compare as they are, as in SQLite. Text sorts as before. The order of numbers against text in one column is unchanged (that belongs to the comparison work in #2595).

Test: test/test2275-B.js. Found while looking at the ORDER BY pull requests.

@mathiasrw mathiasrw added this to the v4.x Focus milestone Oct 20, 2026
@mathiasrw
mathiasrw merged commit 8369420 into develop Oct 20, 2026
10 checks passed
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