ST08 — DISTINCT ON without ORDER BY is non-deterministic
Group: Structure · Auto-fixable: no
DISTINCT ON (...) keeps one row per group, but which row survives is arbitrary
unless an ORDER BY pins it down. Add an ORDER BY covering the DISTINCT ON
expressions.
Example
Section titled “Example”bad: SELECT DISTINCT ON (user_id) * FROM eventsgood: SELECT DISTINCT ON (user_id) * FROM events ORDER BY user_id, ts DESCConfigure
Section titled “Configure”Disable this rule in banshee.toml:
[lint]exclude = ["ST08"]Or silence one line with -- noqa: ST08. See Linting.