Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-3085

NULL comparison are not supported for result variables in the HAVING clause

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.2
    • Fix Version/s: 2.5
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      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
      

        Activity

        Hide
        Guilherme Blanco added a comment -

        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.

        Show
        Guilherme Blanco added a comment - 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.

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Christophe Coevoet
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: