Skip to content

[Bug]: False positive for ST11 #2513

@benoit9126

Description

@benoit9126

What happened?

I try to use sqruff fix on this query

SELECT
  "t"."a",
  "t2"."b"
FROM "my_table" AS "t"
  LEFT OUTER JOIN "my_table2" AS "t2" ON "t2"."a" = "t"."a";

I get this output:

$ sqruff fix test.sql 
== [test.sql] FAIL
L:   5 | P:  19 | ST11 | Joined table '"my_table2" AS "t2"' not referenced
                       | elsewhere in query.
                       | [structure.unused_join]
The linter processed 1 file(s).
All Finished 📜 🎉

It seems that the alias of the LEFT OUTER JOIN table my_table2 is not well considered. Note that with an inner join, there is no problem.

Version

I am using sqruff 0.37.3

Checked in Playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions