kasvith opened a new issue, #1537:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1537

   Hi, the following is a valid MSSQL syntax
   
   When parsed with the `sql-parser-rs` 
   
   ```sql
   WITH RecursiveCTE AS (
       -- Anchor member
       SELECT TOP 1
           [ID],
           CAST([Amount] AS NUMERIC) AS [Amount],
           CAST([Balance] AS NUMERIC) AS [Balance],
           (SELECT TOP 1 [FixedValue] FROM [Settings] ORDER BY [ID] DESC) AS 
[Constant]
       FROM [Transactions]
       ORDER BY [ID] ASC
   
       UNION ALL
   
       -- Recursive member
       SELECT
           [ID] + 1 AS [ID],
           CAST([Amount] * 0.8 AS NUMERIC) AS [Amount],
           CAST(([Amount] * 0.8 - [Constant]) AS NUMERIC) AS [Balance],
           [Constant]
       FROM RecursiveCTE
       WHERE [Balance] > 0
   )
   SELECT [ID], [Balance]
   FROM RecursiveCTE
   ORDER BY [ID] ASC;
   ```
   
   it gives the following error
   
   ```bash
   sql parser error: Expected: ), found: UNION at Line: 11, Column: 5
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to