You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the issues and found no similar issues.
What Happened
I have the following query
SELECT * FROM (
SELECT col FROM dbo.tab
UNION
SELECT -1 AS col
) AS a
I tried to format that.
Expected Behaviour
Query is formatted and still executable.
Observed Behaviour
Query broken.
How to reproduce
PS > cat .\sqlfluff-9.config
[sqlfluff]
dialect = tsql
templater = raw
PS > cat .\sqlfluff-9.sql
SELECT * FROM (
SELECT col FROM dbo.tab
UNION
SELECT -1 AS col
) AS a
PS > sqlfluff fix .\sqlfluff-9.sql --config .\sqlfluff-9.config
==== finding fixable violations ====
== [sqlfluff-9.sql] FAIL
L: 5 | P: 6 | L025 | Alias 'a' is never used in SELECT statement.
==== fixing violations ====
1 fixable linting violations found
Are you sure you wish to attempt to fix these? [Y/n]
Dialect
tsql
Version
current git
Configuration
see above
Are you willing to work on and submit a PR to address the issue?
Got it -- I bet I need to check for a different segment type, because using UNION wraps the select_statement in a surrounding segment type. I can probably fix it this morning, not sure if I can get a reviewer before we release 1.1.0 today.
Search before asking
What Happened
I have the following query
I tried to format that.
Expected Behaviour
Query is formatted and still executable.
Observed Behaviour
Query broken.
How to reproduce
Dialect
tsql
Version
current git
Configuration
see above
Are you willing to work on and submit a PR to address the issue?
Code of Conduct
The text was updated successfully, but these errors were encountered: