Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP1universalStack: sql
sqlsortingdeterminismpaginationbug
Add a tiebreaker so sorts are deterministic on equal keys
When the sort key can repeat (name, count), rows with equal keys can come back in any order across queries; add a stable secondary key (e.g. id) so order is deterministic.
PR: profico-mining-2026-06Created: Jul 26, 2026
Bad example
Old codesql
| 1 | ORDER BY name |
Explanation (EN)
Objašnjenje (HR)
Good example
New codesql
| 1 | ORDER BY name, id |
Explanation (EN)
Objašnjenje (HR)