DDC-3085: NULL comparison are not supported for result variables in the HAVING clause #3829

Closed
opened 2026-01-22 14:28:44 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Apr 15, 2014).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user stof:

the following DQL query fails saying that score does not point to a class:

SELECT u AS user, SUM(r.value) AS score
FROM User u
LEFT JOIN ResultEntry r WITH r.user = u
GROUP BY u
HAVING score IS NOT NULL AND score >= 5

When removing the condition score IS NOT NULL, the query is working fine. The score result variable can be used in other comparisons:

SELECT u AS user, SUM(r.value) AS score
FROM User u
LEFT JOIN ResultEntry r WITH r.user = u
GROUP BY u
HAVING score >= 5
Originally created by @doctrinebot on GitHub (Apr 15, 2014). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user stof: the following DQL query fails saying that `score` does not point to a class: ``` sql SELECT u AS user, SUM(r.value) AS score FROM User u LEFT JOIN ResultEntry r WITH r.user = u GROUP BY u HAVING score IS NOT NULL AND score >= 5 ``` When removing the condition `score IS NOT NULL`, the query is working fine. The `score` result variable can be used in other comparisons: ``` sql SELECT u AS user, SUM(r.value) AS score FROM User u LEFT JOIN ResultEntry r WITH r.user = u GROUP BY u HAVING score >= 5 ```
admin added the Bug label 2026-01-22 14:28:44 +01:00
admin closed this issue 2026-01-22 14:28:45 +01:00
Author
Owner

@doctrinebot commented on GitHub (Apr 21, 2014):

Comment created by @guilhermeblanco:

Added coverage for this issue on master as of 63d21ca4b2
I'm unable to "fix" this because it's an enhancement to DQL (support ResultVariable in NullComparisonExpression) that cannot be done in 2.4 series. Please use 2.5 (currently dev-master) instead.

@doctrinebot commented on GitHub (Apr 21, 2014): Comment created by @guilhermeblanco: Added coverage for this issue on master as of https://github.com/doctrine/doctrine2/commit/63d21ca4b28cb0e9192dadf6ff9d9dd17f0c2e4c I'm unable to "fix" this because it's an enhancement to DQL (support ResultVariable in NullComparisonExpression) that cannot be done in 2.4 series. Please use 2.5 (currently dev-master) instead.
Author
Owner

@doctrinebot commented on GitHub (Apr 21, 2014):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Apr 21, 2014): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3829