Skip to content

self-alias

SQLcleanupno fixdefault: warnsql/sqlfluff

Reports an alias that repeats the name it is given to, as in a AS a.

The alias does nothing: the name of the column is already a.

To fix, remove the alias.

Reported
...
select distinct a from t;
select a from t group by a;
select a as a, b as c, d.e as e from t;
...
select a from t join u on t.a = u.a join v on t.a = v.b;
...
sql:
lint:
rules:
self-alias: warn # off, warn (default), error

Enabled by the presets: sql/sqlfluff.

Suppress one line with sudsy-disable-next-line self-alias in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
sqlfluff AL09 full