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
Description
The issue exists in the latest version of sqlglot 26.6.0. When applying limit operation on a Union node and converting to T-SQL, we get an expression which is invalid in T-SQL.
Fully reproducible code snippet
>>> parse_one("select count(*) from a union select count(*) from b", dialect="tsql").limit(5).sql(dialect="tsql")
'SELECT TOP 5 * FROM (SELECT COUNT(*) FROM a UNION SELECT COUNT(*) FROM b) AS _l_0'
While this looks correct, it throws syntax error as shown in the image below. Note that the union query works as a standalone but not when placed within parantheses. (See error message at the bottom of the image.)
Official Documentation
Couldn't find the official documentation explaining this situation, but it should be reproducible anywhere I think.
The text was updated successfully, but these errors were encountered:
Description
The issue exists in the latest version of sqlglot
26.6.0
. When applyinglimit
operation on aUnion
node and converting to T-SQL, we get an expression which is invalid in T-SQL.Fully reproducible code snippet
While this looks correct, it throws syntax error as shown in the image below. Note that the union query works as a standalone but not when placed within parantheses. (See error message at the bottom of the image.)
Official Documentation
Couldn't find the official documentation explaining this situation, but it should be reproducible anywhere I think.
The text was updated successfully, but these errors were encountered: