Search before asking
What Happened
[redshift] sqlfluff 2.0.2 reports (and fixes) aliasing.unused where the alias is (correctly) not being used in a select statement, but is used unnesting an array in the from statement.
Example:
-- redshift
SELECT
my_column,
my_array_value
FROM my_schema.my_table AS t, t.super_array AS my_array_value
L: 4 | P: 28 | AL05 | Alias 't' is never used in SELECT statement.
| [aliasing.unused]
Expected Behaviour
The alias is being validly used in the FROM clause of this SELECT statement, and this rule should not trigger.
Observed Behaviour
The table alias is reported as unused, and sqlfluff fix removes it, making the query invalid.
How to reproduce
Reproducer included in What Happened
Dialect
Redshift
Version
2.0.2 (python 3.10.6)
Configuration
Default configuration (aside from dialect).
Are you willing to work on and submit a PR to address the issue?
Code of Conduct
Search before asking
What Happened
[redshift] sqlfluff 2.0.2 reports (and fixes) aliasing.unused where the alias is (correctly) not being used in a select statement, but is used unnesting an array in the from statement.
Example:
Expected Behaviour
The alias is being validly used in the FROM clause of this SELECT statement, and this rule should not trigger.
Observed Behaviour
The table alias is reported as unused, and
sqlfluff fixremoves it, making the query invalid.How to reproduce
Reproducer included in What Happened
Dialect
Redshift
Version
2.0.2 (python 3.10.6)
Configuration
Default configuration (aside from dialect).
Are you willing to work on and submit a PR to address the issue?
Code of Conduct