You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make the standard comparison level the default, with dates by value and SQLite's order across types #3171
After #3163 AlaSQL has one comparator with the old rules. = compiles to ===, so two Date objects with the same time are not equal in WHERE, IN or a join, while <, GROUP BY and DISTINCT treat them as equal. Values of different types compare as JavaScript does, so 2 < 'b' and 2 > 'b' are both false.
constd1=newDate(2024,0,1),d2=newDate(2024,0,1);alasql('SELECT * FROM ? WHERE d = ?',[[{d: d1}],d2]);// []
standard emits typeof a === 'number' && typeof b === 'number' ? a > b : alasql.cmp(a, b) > 0.
strict always calls alasql.cmp.
alasql.cmp(a, b) orders NULL first, then numbers (and bigints), then text, then dates by time value. Two dates are equal when their time values are equal.
The code generator asks the module for the source text of =, <>, <, >, <=, >=, BETWEEN, IN and join keys instead of writing the operator itself.
Set compare: 'standard' as the default. The engine build and alasql/dialect/v4 set compare: 'fast'.
What stays the same
With compare: 'fast' every result is as in 4.x.
Results on clean numbers or clean text do not change.
In the default, =, IN and joins on equal dates now match, and a number against a text follows SQLite's order.
Done when
A new test file named after this issue covers =, <>, IN and a join on equal Date objects, a number against a text, and the same queries with alasql/dialect/v4 giving the 4.x results.
The dialect test against SQLite gets cases for comparisons across types, and their expected differences are removed.
The full test suite and the CI checks (dialect test, parity check, run-state check, binding check) pass, and the pull request lists every parity difference.
Activity