Skip to content

Table aliases might not be resolved when SubselectFromClause is being processed and wrong alias is generated #105

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

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

paranoiq
Copy link
Member

@paranoiq paranoiq commented Jul 8, 2024

UseIndexHintHandler registers listening for FromClause and SubselectFromClause. when hint is intended for main FROM and the handler is called with the subselect, the table aliases for the whole query might not be resolved (depends also on columns in SELECT clause) and SqlWalker generates wrong alias. the handler then fails to find and replace that clause ("LogicException: Invalid hint for index IDX_WAREHOUSE_PRODUCT__EMPTY, table occurrence with DQL alias occ is not present in the query.")

probable cause is that Doctrine changed order of processing things. otherwise i have no idea how it could have ever worked

aliases should either be resolved before processing index hints or they should be independent of order

@paranoiq paranoiq force-pushed the vn-fix-subqueries branch from 9c24a45 to 14f8ba1 Compare July 8, 2024 14:43
@janedbal
Copy link
Member

janedbal commented Jul 9, 2024

I believe we can now remove the second DQL parsing resulting in $wholeSql (introduced in https://github.com/shipmonk-rnd/doctrine-mysql-index-hints/pull/103/files)

@paranoiq paranoiq force-pushed the vn-fix-subqueries branch from 14f8ba1 to b0ac665 Compare July 9, 2024 09:32
@janedbal janedbal merged commit 19e5c01 into master Jul 9, 2024
7 checks passed
@janedbal janedbal deleted the vn-fix-subqueries branch July 9, 2024 10:53
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.

2 participants