Part-DB-server icon indicating copy to clipboard operation
Part-DB-server copied to clipboard

Sort Storage locations numerically

Open sochartgit opened this issue 1 year ago • 3 comments

Describe the bug Storage locations are sorted in an alphabetically way which is inconsistent when using drawer numbers.

** Actual behavior ** 1 10 100 101 . . 11 110 111

Expected behavior 1 2 3 4 5 6 7 8 9 10

sochartgit avatar Oct 11 '23 21:10 sochartgit

The sorting is done by the database, and most databases can order strings only in the binary way not the natural sorting, which you want. This is a similar problem as issue #243

jbtronics avatar Oct 15 '23 10:10 jbtronics

There is a way to sort naturally in databases https://www.mysqltutorial.org/mysql-natural-sorting/

sochartgit avatar Oct 17 '23 13:10 sochartgit

Yes but that is not portable, as it does not work on MySQL and SQLite. And even then this requires a pretty new MariaDB version.

jbtronics avatar Oct 17 '23 13:10 jbtronics

With the latest commit Part-DB supports natural sort on postgres and MariaDB 10.7+ (and via slow emulation on other platforms)

jbtronics avatar Jun 18 '24 21:06 jbtronics