QoQ and QuerySort don't sort varchar columns correctly

Description

When sorting a query varchar column, the sort is implemented inconsistently. For example if I have a query with a 'name' column and I have the following two values in it:

  • Copay Plan With Wellness

  • Copay Plan Without Wellness

If I sort 'asc', the 'Copay Plan Without Wellness' appears before the 'Copay Plan With Wellness'. The incorrect sorting happens when doing this:

q = queryExecute("SELECT name FROM q ORDER BY name", {}, {dbType: "query"});

or using the querySort functionality like so:

querySort(q, 'name', 'asc')

You can see the cf-gist here:

https://trycf.com/gist/3f3ce789c5f8a7ac81d23561108b77e3/lucee5?theme=monokai

Environment

Windows 2016

Activity

Show:
Pothys - MitrahSoft
October 1, 2019, 6:26 AM

I've checked this ticket & confirmed the issue happened on Lucee both affected and latest version of 5.3.5.14 also. But it works as expected in an ACF

Pothys - MitrahSoft
October 9, 2019, 8:17 AM

I've added a test case for this ticket

Pull Request: https://github.com/lucee/Lucee/pull/768

Pothys - MitrahSoft
November 14, 2019, 11:17 AM

I've added a fix for this ticket. If this fix merges, it will fix the ticket too.

Pull Request: https://github.com/lucee/Lucee/pull/791

Michael Offner
May 1, 2020, 4:23 PM

sorry i had to reject this, you cannot simply go to a simple string comparsion and bypass all the logic, that will cause other issue with code depending on that logic

provlem is with the Collator here

Michael Offner
May 1, 2020, 7:10 PM

 

Fixed

Assignee

Michael Offner

Reporter

brett deline

Priority

Major

Labels

Fix versions

Sprint

None

Affects versions

Configure