2

In my sql-script I query some data like this:

SELECT * 
FROM abc.[x/y/z]()

This query works completely fine

However sqlfluff lint returns Found unparsable section '()' .

Sqlfluff parsing works fine with regular table valued functions calls without '/' in the name:

SELECT * 
FROM abc.[xyz]()

Is there a way to configure the sqlfluff parser or sqlfluff t-sql dialact to handle this syntax?

Note that I have selected the dialect t-sql

phlope
  • 31
  • 7
  • A minor note, but this is not actually valid T-SQL. `TABLE` is a keyword that must be escaped in all contexts. `[table].[x/y/z]()` would be valid, although it would refer to a table-valued function named `x/y/z` in a schema named `table`, which is not the best of naming schemes... – Jeroen Mostert Feb 27 '23 at 08:45
  • @JeroenMostert You are right. I have chosen the word 'table' as an alias to make the problem public and more easy to understand. I will change it that we can focus on the original error. Also table_valued_function would have been a better name ;) Thank you for the comment. – phlope Feb 27 '23 at 08:57
  • I wonder what sqlfluff does with `SELECT 1 AS [/* This is not the start of a comment]` in terms of highlighting, or maybe `SELECT 1 AS [/* FROM NonTable] FROM ActualTable`. I suspect it may not be completely comfortable with T-SQL escaping. – Jeroen Mostert Feb 27 '23 at 09:00

0 Answers0