Bug #97976 NULL sorts as 0 incorrectly
Submitted: 12 Dec 2019 21:10 Modified: 8 Jan 2020 11:19
Reporter: Ben Towne Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version: OS:Windows (10 Pro)
Assigned to: CPU Architecture:Any

[12 Dec 2019 21:10] Ben Towne
Description:
NULL==0 for sort purposes and shouldn't

How to repeat:
In MySQLWorkbench Modeling, add a table.
Make sure there is at least one column of type INT where NULL is allowed.
Go to the Inserts tab on the bottom strip.
Add some rows.  Some should remain with NULL in the target column, some should have 0 values, and some should have nonzero values.

Export the file to CSV, open and save in Excel, and import the file. Delete the new header row and the prior rows.

Click the column header to sort by that column.

Notice that zeros are interspersed with the "NULL" (text) values, instead of being consistently sorted after (or before) the NULLs. 

The intention is to mark the "NULL" values as actually null again. 

Suggested fix:
Treat 0, "NULL," and NULL differently for sorting purposes.
[8 Jan 2020 11:19] MySQL Verification Team
Hello Ben Towne,

Thank you for the bug report.
Verified as described.

Regards,
Ashwini Patil
[8 Jan 2020 11:21] MySQL Verification Team
8.0.18 test results

Attachment: 97976_test_results.png (image/png, text), 357.54 KiB.