Skip to content

Commit 7bb3a4a

Browse files
committed
fix cte with union
1 parent a2b697f commit 7bb3a4a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mindsdb_sql_parser/parser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,14 +1106,15 @@ def select(self, p):
11061106
select.cte = p.ctes
11071107
return select
11081108

1109-
@_('ctes COMMA identifier cte_columns_or_nothing AS LPAREN select RPAREN')
1109+
@_('ctes COMMA identifier cte_columns_or_nothing AS LPAREN select RPAREN',
1110+
'ctes COMMA identifier cte_columns_or_nothing AS LPAREN union RPAREN')
11101111
def ctes(self, p):
11111112
ctes = p.ctes
11121113
ctes = ctes + [
11131114
CommonTableExpression(
11141115
name=p.identifier,
11151116
columns=p.cte_columns_or_nothing,
1116-
query=p.select)
1117+
query=p[6])
11171118
]
11181119
return ctes
11191120

0 commit comments

Comments
 (0)