fix postgres eager loading alias bug - #19552
Merged
dereuromark merged 1 commit intoJul 20, 2026
Merged
Conversation
Member
Author
|
@Mapiiik may you test this PR if it fixes your problem? and perform a |
|
Thank you very much @LordSimal! Tested the PR and it looks good. Before (broken): After (fixed): Works as expected now. |
Contributor
|
@LordSimal Does cake always auto-quote the select alias outside of subqueries? |
Member
Author
|
@othercorey Select Aliases have always been quoted for PostgreSQL but this specific bug was for sub-queries specifically where this logic was not yet applied. |
markstory
added a commit
that referenced
this pull request
Sep 13, 2026
Add new cases to DriverFeatureEnum for recently added driver specific behavior related to subquery association loading. I'd like to avoid having driver specific logic in the ORM layer. We have Driver::supports() which allows us to model this driver specific behavior like we do for other driver/dialect specific feature support. Refs #19596 Refs #19552
markstory
added a commit
that referenced
this pull request
Sep 15, 2026
…9619) * Add DriverFeatureEnum for recently added driver specific behavior Add new cases to DriverFeatureEnum for recently added driver specific behavior related to subquery association loading. I'd like to avoid having driver specific logic in the ORM layer. We have Driver::supports() which allows us to model this driver specific behavior like we do for other driver/dialect specific feature support. Refs #19596 Refs #19552 * Apply suggestions from code review Co-authored-by: othercorey <[email protected]> --------- Co-authored-by: othercorey <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #19551
Fix PostgreSQL subquery eager loading for hasMany / belongsToMany associations when quoteIdentifiers is disabled by quoting the derived-table select alias in the generated join condition.
PostgreSQL always treats quoted select aliases as case-sensitive. The subquery loader emitted aliases like:
but referenced them in the join condition as:
With auto-quoting disabled, PostgreSQL folds that to lowercase and fails with
column authors.authors__id does not exist.