-
-
Notifications
You must be signed in to change notification settings - Fork 873
Description
Search before asking
- I searched the issues and found no similar issues.
What Happened
This query results in an unparseable error:
declare @point_in_time datetime2(7) = SYSUTCDATETIME();
select segmentation_id
from
segmentation.line for system_time as of @point_in_time as t0
where
segmentation_id = @point_in_time
Expected Behaviour
Allow for the use of declared variables in the for system_time
clause of a system-versioned table in the T-SQL dialect.
Observed Behaviour
== [bug.sql] FAIL
L: 3 | P: 1 | LT09 | Select targets should be on a new line unless there is
| only one select target.
| [layout.select_targets]
L: 4 | P: 5 | RF01 | Reference 't0.segmentation_id' refers to table/view not
| found in the FROM clause or found in ancestor statement.
| [references.from]
L: 4 | P: 23 | PRS | Line 4, Position 23: Found unparsable section:
| ',\nfrom\n segmentation.line for system_...'
WARNING: Parsing errors found and dialect is set to 'tsql'. Have you configured your dialect correctly?
How to reproduce
declare @point_in_time datetime2(7) = SYSUTCDATETIME();
select t0.some_column
from
table0 for system_time as of @point_in_time as t0
Dialect
T-SQL
Version
sqlfluff, version 2.3.5
Python 3.11.5
Configuration
[sqlfluff]
dialect = tsql
[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = lower
Are you willing to work on and submit a PR to address the issue?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct