mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
Ascending rating/difficulty/completion sorts split visually identical "unrated" games into two buckets: touched-but-unrated rows carry the NOT NULL default 0 and led the list while never-touched games trailed it. The three zero-default sort keys are now wrapped in NULLIF(col, 0) so both unset shapes share the final bucket, tiebroken by rom id. Metadata sorts kept each engine's default NULL placement: MariaDB led ascending release-date sorts with the wall of unmatched roms while PostgreSQL trailed it. NULLs now land last on every engine in both directions, emitted per dialect to keep index reads where the engine allows them: PostgreSQL uses native NULLS LAST, MariaDB descending already places NULLs last on the plain index read, and only MariaDB ascending pays a measured filesort (EXPLAIN at 30k roms: 51ms index read to ~150ms), the one case the engine cannot serve from a single-column index. Fixes #4449 Fixes #4450 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ldi4YaXJWDDmFdbKfQay8L