Skip to content

MySQL WITH clause recursive subquery error fix #35146

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Yash-cor
Copy link
Contributor

@Yash-cor Yash-cor commented Apr 9, 2025

Fixes #35164.

Changes proposed in this pull request:

When RECURSIVE is used in WITH clause of MySQL it was not able to catch the Shorthand Projection of an existing table.
Made changes so that it supports it now.

For Example - WITH RECURSIVE cte AS ( SELECT * from t_user UNION ALL SELECT user_id+1, name FROM cte WHERE user_id < 5 ) SELECT * FROM cte;

So in this CommonTableExpressionSegmentBinder was not catching the shorthand projection segment when RECURSIVE keyword is used and that cte alias is used inside the subquery.


Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.
  • I have updated the Release Notes of the current development version. For more details, see Update Release Note

@Yash-cor Yash-cor marked this pull request as draft April 9, 2025 05:51
@Yash-cor Yash-cor changed the title My sql with clause recursive subquery error MySQL WITH clause recursive subquery error fix Apr 9, 2025
@Yash-cor Yash-cor marked this pull request as ready for review April 9, 2025 07:57
@Yash-cor
Copy link
Contributor Author

Hello @strongduanmu can you review this PR and add enhancement label to this PR

@strongduanmu
Copy link
Member

Hello @strongduanmu can you review this PR and add enhancement label to this PR

@Yash-cor Can you submit a pr to describe the exception first?

@Yash-cor
Copy link
Contributor Author

Hello @strongduanmu can you review this PR and add enhancement label to this PR

@Yash-cor Can you submit a pr to describe the exception first?

Ok I will file an Issue for this

@Yash-cor
Copy link
Contributor Author

Yash-cor commented Apr 11, 2025

Hello @strongduanmu can you review this PR and add enhancement label to this PR

@Yash-cor Can you submit a pr to describe the exception first?
Hello @strongduanmu I have created an issue for this.
ISSUE link - #35164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WITH clause RECURSIVE subquery Unknown column exception when shorhand projection are used.
2 participants