group-order-style
What it does
Section titled “What it does”Reports a GROUP BY or ORDER BY clause that lists both column names or expressions and column positions (1, 2), or that lists them in the other way than the first such clause of the file.
Why it matters
Section titled “Why it matters”Positions are short but depend on the order of the select list: a column added to the front changes what GROUP BY 1 means, with no error. A clause that mixes the two is read in two ways.
To fix, use names in every clause, or positions in every one.
Example
Section titled “Example”...select a, b from t group by a, 2;with c as (select a from t) select * from c;select x.a from (select * from t) as x;...Configuration
Section titled “Configuration”sql: lint: rules: group-order-style: warn # off (default), warn, errorEnabled by the presets: sql/sqlfluff.
Suppress one line with sudsy-disable-next-line group-order-style in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| sqlfluff | AM06 |
full |