return syntax error when order by or limit before union in mysql mode

This commit is contained in:
obdev
2023-09-01 07:10:52 +00:00
committed by ob-robot
parent bf0272041a
commit 6d8fedae8b
11 changed files with 25 additions and 40 deletions

View File

@ -1820,7 +1820,7 @@ select c,d from cte2;
+------+------+
with RECURSIVE
cte2(c,d) AS (select c1, c2 + 1 as c3 from t1 order by c2 union all select c+1, d+1 from cte2 where c < 30)
cte2(c,d) AS ((select c1, c2 + 1 as c3 from t1 order by c2) union all select c+1, d+1 from cte2 where c < 30)
select c,d from cte2;
+------+------+
| c | d |
@ -1828,12 +1828,12 @@ select c,d from cte2;
+------+------+
explain basic with RECURSIVE
cte2(c,d) AS (select * from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
cte2(c,d) AS ((select * from t1 left join t2 on t1.c1=t2.c1 order by t1.c1) union all select c+1, d+1 from cte2 where c < 30)
select c1 from cte2;
ERROR HY000: View's SELECT and view's field list have different column counts
with RECURSIVE
cte2(c,d) AS (select t1.c1, t2.c2 from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
cte2(c,d) AS ((select t1.c1, t2.c2 from t1 left join t2 on t1.c1=t2.c1 order by t1.c1) union all select c+1, d+1 from cte2 where c < 30)
select c from cte2;
+------+
| c |

View File

@ -1197,7 +1197,7 @@ select c,d from cte2;
## 带有order
with RECURSIVE
cte2(c,d) AS ( select c1, c2 + 1 as c3 from t1 order by c2 union all select c+1, d+1 from cte2 where c < 30)
cte2(c,d) AS ( (select c1, c2 + 1 as c3 from t1 order by c2) union all select c+1, d+1 from cte2 where c < 30)
select c,d from cte2;
+------+------+
| c | d |
@ -1352,7 +1352,7 @@ select c,d from cte2;
+------+------+
with RECURSIVE
cte2(c,d) AS (select t1.c1, t2.c2 from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
cte2(c,d) AS ((select t1.c1, t2.c2 from t1 left join t2 on t1.c1=t2.c1 order by t1.c1) union all select c+1, d+1 from cte2 where c < 30)
select c from cte2;
+------+
| c |

View File

@ -1150,16 +1150,16 @@ select c,d from cte2;
with RECURSIVE
cte2(c,d) AS (select c1, c2 + 1 as c3 from t1 order by c2 union all select c+1, d+1 from cte2 where c < 30)
cte2(c,d) AS ((select c1, c2 + 1 as c3 from t1 order by c2) union all select c+1, d+1 from cte2 where c < 30)
select c,d from cte2;
--error 1353
explain basic with RECURSIVE
cte2(c,d) AS (select * from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
cte2(c,d) AS ((select * from t1 left join t2 on t1.c1=t2.c1 order by t1.c1) union all select c+1, d+1 from cte2 where c < 30)
select c1 from cte2;
with RECURSIVE
cte2(c,d) AS (select t1.c1, t2.c2 from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
cte2(c,d) AS ((select t1.c1, t2.c2 from t1 left join t2 on t1.c1=t2.c1 order by t1.c1) union all select c+1, d+1 from cte2 where c < 30)
select c from cte2;

View File

@ -290,11 +290,11 @@ select c,d from cte2;
## 带有order
with RECURSIVE
cte2(c,d) AS ( select c1, c2 + 1 as c3 from t1 order by c2 union all select c+1, d+1 from cte2 where c < 30)
cte2(c,d) AS ( (select c1, c2 + 1 as c3 from t1 order by c2) union all select c+1, d+1 from cte2 where c < 30)
select c,d from cte2;
with RECURSIVE
cte2(c,d) AS (select t1.c1, t2.c2 from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
cte2(c,d) AS ((select t1.c1, t2.c2 from t1 left join t2 on t1.c1=t2.c1 order by t1.c1) union all select c+1, d+1 from cte2 where c < 30)
select c from cte2;