Skip to content

Fix order by dates in queries with incomplete type information - #1649

Merged
mathiasrw merged 5 commits into
AlaSQL:developfrom
Buroni:Buroni/fix/order-by-dates
Mar 12, 2023
Merged

mathiasrw merged 5 commits into
AlaSQL:developfrom
Buroni:Buroni/fix/order-by-dates

Conversation

@Buroni

@Buroni Buroni commented Mar 10, 2023 •

Copy link
Copy Markdown
Contributor

Fixes #1513

Proposed changes

  • Set alasql.options.valueof = true by default. This was originally false for backwards compatibility reasons, but causes problems when sorting dates in anonymous queries and queries where the SELECT result doesn't include the date column used in the ORDER BY clause (E.g. SELECT i FROM tbl ORDER BY date, i).
  • Small refactor of order by logic to always use valueof in ParamValues and Columns when options.valueof = true;. It seems like this was the original intention but the options.valueof check was being done in the wrong place.

Notes

  • It looks like yarn format has also touched some files not related to this work.
  • There's some duplication in the orderby code that could be refactored into something nicer I think. Although I've followed the existing pattern for now to make the solution clearer.

@mathiasrw

Copy link
Copy Markdown
Member

Thank you!

@mathiasrw
mathiasrw merged commit 15d9108 into AlaSQL:develop Mar 12, 2023
@mathiasrw

Copy link
Copy Markdown
Member

We need to bump the major version so will bundle this change with a few others we have been talking about.

@mathiasrw

Copy link
Copy Markdown
Member

This has not been forgotten...

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.

ORDER BY and dates issue

2 participants