提交 60033163 authored 作者: Thomas Mueller's avatar Thomas Mueller

UNION queries where the first query contains a nested query were parsed incorrectly.

上级 e4b3f4e5
...@@ -951,10 +951,8 @@ public class Parser { ...@@ -951,10 +951,8 @@ public class Parser {
String alias = null; String alias = null;
if (readIf("(")) { if (readIf("(")) {
if (isSelect()) { if (isSelect()) {
int start = lastParseIndex;
Query query = parseSelectUnion(); Query query = parseSelectUnion();
read(")"); read(")");
query = parseSelectUnionExtension(query, start, true);
ArrayList<Parameter> params = New.arrayList(); ArrayList<Parameter> params = New.arrayList();
for (int i = 0; i < parameters.size(); i++) { for (int i = 0; i < parameters.size(); i++) {
params.add(parameters.get(i)); params.add(parameters.get(i));
......
--- special grammar and test cases --------------------------------------------------------------------------------------------- --- special grammar and test cases ---------------------------------------------------------------------------------------------
select 1, 2 from (select * from dual) union all select 3, 4 from dual;
> 1 2
> - -
> 1 2
> 3 4
> rows: 2
select 3 from (select * from dual) union all select 2 from dual;
> 3
> -
> 2
> 3
> rows: 2
create table a(x int, y int); create table a(x int, y int);
> ok > ok
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论