duplicate-column-alias
What it does
Section titled “What it does”Reports two select elements with the same column name, compared without case and quotes: an alias, or the last part of a plain column reference.
Why it matters
Section titled “Why it matters”The result has two columns with one name. Clients that read the result by name get only one of them, a subquery or a view built on it is rejected by some databases, and which one wins is not defined.
To fix, give one of them another alias.
Example
Section titled “Example”...select a, b as a from t;...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: duplicate-column-alias: warn # off (default), warn, errorEnabled by the presets: sql/sqlfluff.
Suppress one line with sudsy-disable-next-line duplicate-column-alias 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 | AL08 |
full |