thswlsqls opened a new pull request, #40073:
URL: https://github.com/apache/shardingsphere/pull/40073

   Fixes #35164.
   
   Changes proposed in this pull request:
     - When a recursive CTE has no column list, 
`CommonTableExpressionSegmentBinder#createRecursiveWithProjections` turned a 
shorthand anchor projection (`SELECT *`, `t.*`) into a single column named `*`, 
so the recursive member and the outer query failed with `Unknown column` for 
every CTE column.
     - The no-column-list path now builds the CTE columns with 
`SubqueryTableBindUtils.createSubqueryProjections`, the same call the 
column-list branch and the non-recursive path already use, which expands 
shorthand projections. The anchor query is still bound once.
     - Side effect: an aliased anchor column (`SELECT user_id AS id ...`) is 
now exposed to the recursive member as `id` rather than `user_id`, matching 
MySQL and PostgreSQL semantics.
     - Added 
`SelectStatementBinderTest#assertBindRecursiveCteWithShorthandAnchorProjection`;
 it fails with `ColumnNotFoundException` without the fix.
   
   AI assistance: Claude Code was used to draft the change and its unit test in 
`infra/binder/core` (`CommonTableExpressionSegmentBinder`, 
`SelectStatementBinderTest`) and the `RELEASE-NOTES.md` entry. I reviewed, 
verified, and take responsibility for every line submitted.
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following 
options:
   - [x] My code follows the [code of 
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) 
of this project.
   - [x] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the 
pull request. (I don't have permission to add labels.)
   - [ ] I have passed maven check locally : `./mvnw clean install -B -T1C 
-Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`. (Not run for the whole 
repository; I ran `spotless:apply`, `checkstyle:check`, and `apache-rat:check` 
with `-Pcheck -pl infra/binder/core`, `./mvnw install -pl infra/binder/core -am 
-B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`, and the `test/it/binder` 
IT suite, all passing. E2E tests were not run.)
   - [ ] I have made corresponding changes to the documentation. (No 
user-facing documentation is affected.)
   - [x] I have added corresponding unit tests for my changes.
   - [x] I have updated the Release Notes of the current development version. 
For more details, see [Update Release 
Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)
   - [x] I have disclosed the tool and affected files or scope for any material 
AI assistance, as required by the [AI-assisted contribution policy].
   
   [AI-assisted contribution policy]: 
https://github.com/apache/shardingsphere/blob/master/AI_POLICY.md
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to