Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsing CTE statements errors #47711

Closed
Rustin170506 opened this issue Oct 17, 2023 · 3 comments · Fixed by #48188
Closed

parsing CTE statements errors #47711

Rustin170506 opened this issue Oct 17, 2023 · 3 comments · Fixed by #48188

Comments

@Rustin170506
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Try to run:

with a as (select 8 as id from dual),
maxa as (select max(id) as max_id from a),
b as (
with recursive temp as (
select 1 as lvl from dual
union all
select lvl+1 from temp, maxa where lvl < max_id
)
select * from temp
)
select * from b;

2. What did you expect to see? (Required)

Get the right result.

mysql> with a as (select 8 as id from dual),
    -> maxa as (select max(id) as max_id from a),
    -> b as (
    -> with recursive temp as (
    -> select 1 as lvl from dual
    -> union all
    -> select lvl+1 from temp, maxa where lvl < max_id
    -> )
    -> select * from temp
    -> )
    -> select * from b;
+------+
| lvl  |
+------+
|    1 |
|    2 |
|    3 |
|    4 |
|    5 |
|    6 |
|    7 |
|    8 |
+------+
8 rows in set (0.01 sec)

3. What did you see instead (Required)

mysql> with a as (select 8 as id from dual), maxa as (select max(id) as max_id from a), b as ( with recursive temp as ( select 1 as lvl from dual union all select lvl+1 from temp, maxa where lvl < max_id ) select * from temp ) select * from b;
ERROR 3575 (HY000): Recursive Common Table Expression '' can contain neither aggregation nor window functions in recursive query block

4. What is your TiDB version? (Required)

Introduced by 150813d#diff-3b47fd3bf2c33ae3a03037a65ed39df33a4ae73debe9cf6f5bb2f397508061a0

@elsa0520
Copy link
Contributor

/assign @elsa0520

ti-chi-bot bot pushed a commit that referenced this issue Nov 8, 2023
ti-chi-bot bot pushed a commit that referenced this issue Nov 9, 2023
ti-chi-bot bot pushed a commit that referenced this issue Nov 10, 2023
ti-chi-bot bot pushed a commit that referenced this issue Nov 10, 2023
@kennedy8312
Copy link

/type regression

@kennedy8312
Copy link

Regression Analysis
PR caused this regression: PR 37800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment