提交 22a0a639 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Allow parentheses around final action in WITH

上级 3f586cbb
......@@ -5508,6 +5508,10 @@ public class Parser {
// used in setCteCleanups.
Collections.reverse(viewsCreated);
int parentheses = 0;
while (readIf(OPEN_PAREN)) {
parentheses++;
}
if (isToken(SELECT)) {
Query query = parseSelectUnion();
query.setPrepareAlways(true);
......@@ -5537,6 +5541,9 @@ public class Parser {
throw DbException.get(ErrorCode.SYNTAX_ERROR_1,
WITH_STATEMENT_SUPPORTS_LIMITED_SUB_STATEMENTS);
}
for (; parentheses > 0; parentheses--) {
read(CLOSE_PAREN);
}
// Clean up temporary views starting with last to first (in case of
// dependencies) - but only if they are not persistent.
......
......@@ -82,3 +82,21 @@ SELECT * FROM SCH.R2;
> 2
> 3
> rows: 3
WITH CTE_TEST AS (SELECT 1, 2) SELECT * FROM CTE_TEST;
> 1 2
> - -
> 1 2
> rows: 1
WITH CTE_TEST AS (SELECT 1, 2) (SELECT * FROM CTE_TEST);
> 1 2
> - -
> 1 2
> rows: 1
WITH CTE_TEST AS (SELECT 1, 2) ((SELECT * FROM CTE_TEST));
> 1 2
> - -
> 1 2
> rows: 1
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论