Repository: sqlfluff/sqlfluff (Python)

Issue:
L027 double raised with wildcard
<!--If this is a parsing or linting issue, please include a minimal SQL example which reproduces the issue, along with the `sqlfluff parse` output, `sqlfluff lint` output and `sqlfluff fix` output when relevant.-->
If you lint this query:
```sql
SELECT *
FROM foo
INNER JOIN bar;
```
L027 is raised twice.

N.B. this does not occur if `*` is replaced with `a` so it is specifically the wildcard causing the issue.
 
## Expected Behaviour
L027 only raised once.

## Observed Behaviour
![image](https://user-images.githubusercontent.com/80432516/143318672-d664122f-dd8b-4d37-9d11-158687594bbb.png)

## Steps to Reproduce
lint the query shown above.

## Dialect
Ansi

## Version
Include the output of `sqlfluff --version` along with your Python version
0.8.2 (HEAD of main)

## Configuration
using default config



Discussion:
Both of these recursive crawls in `get_select_statement_info` are returning the `WildcardIdentifierSegment`:

![image](https://user-images.githubusercontent.com/80432516/143320562-c218b890-dc23-47cc-b372-365dc14241d3.png)

Perhaps the second crawl is unnecessary

Yep wildcard_identifier inherits from object_reference so I'll remove that second crawl

![image](https://user-images.githubusercontent.com/80432516/143321377-acf0094d-2937-4409-9689-9a742b91eb85.png)

![image](https://user-images.githubusercontent.com/80432516/143321180-77fc4aa4-220a-415d-9823-45301d73cd2b.png)




Patch:
diff --git a/src/sqlfluff/core/rules/analysis/select.py b/src/sqlfluff/core/rules/analysis/select.py
index 2f621be3aa7..fbdc577de10 100644
--- a/src/sqlfluff/core/rules/analysis/select.py
+++ b/src/sqlfluff/core/rules/analysis/select.py
@@ -31,8 +31,6 @@ def get_select_statement_info(
     # potential others.
     sc = segment.get_child("select_clause")
     reference_buffer = list(sc.recursive_crawl("object_reference"))
-    # Add any wildcard references
-    reference_buffer += list(sc.recursive_crawl("wildcard_identifier"))
     for potential_clause in (
         "where_clause",
         "groupby_clause",
diff --git a/src/sqlfluff/rules/L027.py b/src/sqlfluff/rules/L027.py
index e7d1d8ac494..506531f8aae 100644
--- a/src/sqlfluff/rules/L027.py
+++ b/src/sqlfluff/rules/L027.py
@@ -1,10 +1,10 @@
 """Implementation of Rule L027."""
 
 from sqlfluff.core.rules.base import LintResult
-from sqlfluff.rules.L025 import Rule_L025
+from sqlfluff.rules.L020 import Rule_L020
 
 
-class Rule_L027(Rule_L025):
+class Rule_L027(Rule_L020):
     """References should be qualified if select has more than one referenced table/view.
 
     NB: Except if they're present in a USING clause.


Test patch:
diff --git a/test/rules/std_L027_test.py b/test/rules/std_L027_test.py
new file mode 100644
index 00000000000..31901509b67
--- /dev/null
+++ b/test/rules/std_L027_test.py
@@ -0,0 +1,15 @@
+"""Tests the python routines within L027."""
+
+import sqlfluff
+
+
+def test__rules__std_L027_wildcard_single_count():
+    """Verify that L027 is only raised once for wildcard (see issue #1973)."""
+    sql = """
+        SELECT *
+        FROM foo
+        INNER JOIN bar;
+    """
+    result = sqlfluff.lint(sql)
+    assert "L027" in [r["code"] for r in result]
+    assert [r["code"] for r in result].count("L027") == 1