Skip to content

unqualified-reference

SQLstyleno fixdefault: offsql/sqlfluff

Reports a column reference without a table in a select over more than one table or view. A name that an alias of another select element or a USING list gives is left alone.

With several tables, a name may exist in more than one of them, now or after a column is added. The query then fails as ambiguous, or the reader cannot tell which table a column comes from.

To fix, qualify the column with the table or its alias.

Reported
...
select a, b from t1 join t2 on t1.id = t2.id;
...
sql:
lint:
rules:
unqualified-reference: warn # off (default), warn, error

Enabled by the presets: sql/sqlfluff.

Suppress one line with sudsy-disable-next-line unqualified-reference 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 RF02 full