Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1405

Define semantics of comparison operators, particularly with regard to null values

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1.2
    • Fix Version/s: None
    • Component/s: Documentation
    • Security Level: All
    • Labels:
      None

      Description

      The Doctrine 2 reference documentation defines the comparison operators syntactically, as:

      ComparisonOperator  ::= "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="
      

      Now, without experimentation, it is pure guesswork to tell whether e. g. null = null, or e. g. null <> null, or null = 0, or null <> 0 are considered true statements in DQL.

      In SQL semantics, all four statements would be false (or more precisely, null). In PHP semantics, both null == null and null == 0 would be true, while null != null and null != 0 would be false.

      It would be helpful to have the semantics of the comparison operators defined. While comparisons with non-null values behave in a common-sense way, it is hard to guess how queries involving comparison operators on fields allowing null values or null query arguments will filter the results, without knowing the exact semantics of the comparison operators with regard to null values.

      It would be great if this could be clarified in the docs.

      Thanks.

        Activity

        Daniel Alvarez Arribas created issue -
        Daniel Alvarez Arribas made changes -
        Field Original Value New Value
        Description The Doctrine 2 reference documentation defines the comparison operators syntactically, as:

        {noformat}
        ComparisonOperator ::= "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="
        {noformat}

        Now, without experimentation, it is pure guesswork to tell whether e. g. null = null, or e. g. null <> null, or null = 0, or null <> 0 are considered true statements in DQL.

        In SQL semantics, all four statements would be false. In PHP semantics, both null == null and null == 0 would be true, while null <> null and null <> 0 would be false.

        It would be helpful to have the semantics of the comparison operators defined. While comparisons with non-null values behave in a common-sense way, it is hard to guess how queries involving comparison operators on fields allowing null values or null query arguments will filter the results, without knowing the exact semantics of the comparison operators with regard to null values.

        It would be great if this could be clarified in the docs.

        Thanks.
        The Doctrine 2 reference documentation defines the comparison operators syntactically, as:

        {noformat}
        ComparisonOperator ::= "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="
        {noformat}

        Now, without experimentation, it is pure guesswork to tell whether e. g. null = null, or e. g. null <> null, or null = 0, or null <> 0 are considered true statements in DQL.

        In SQL semantics, all four statements would be false. In PHP semantics, both null == null and null == 0 would be true, while null != null and null != 0 would be false.

        It would be helpful to have the semantics of the comparison operators defined. While comparisons with non-null values behave in a common-sense way, it is hard to guess how queries involving comparison operators on fields allowing null values or null query arguments will filter the results, without knowing the exact semantics of the comparison operators with regard to null values.

        It would be great if this could be clarified in the docs.

        Thanks.
        Daniel Alvarez Arribas made changes -
        Description The Doctrine 2 reference documentation defines the comparison operators syntactically, as:

        {noformat}
        ComparisonOperator ::= "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="
        {noformat}

        Now, without experimentation, it is pure guesswork to tell whether e. g. null = null, or e. g. null <> null, or null = 0, or null <> 0 are considered true statements in DQL.

        In SQL semantics, all four statements would be false. In PHP semantics, both null == null and null == 0 would be true, while null != null and null != 0 would be false.

        It would be helpful to have the semantics of the comparison operators defined. While comparisons with non-null values behave in a common-sense way, it is hard to guess how queries involving comparison operators on fields allowing null values or null query arguments will filter the results, without knowing the exact semantics of the comparison operators with regard to null values.

        It would be great if this could be clarified in the docs.

        Thanks.
        The Doctrine 2 reference documentation defines the comparison operators syntactically, as:

        {noformat}
        ComparisonOperator ::= "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="
        {noformat}

        Now, without experimentation, it is pure guesswork to tell whether e. g. null = null, or e. g. null <> null, or null = 0, or null <> 0 are considered true statements in DQL.

        In SQL semantics, all four statements would be false (or more precisely, null). In PHP semantics, both null == null and null == 0 would be true, while null != null and null != 0 would be false.

        It would be helpful to have the semantics of the comparison operators defined. While comparisons with non-null values behave in a common-sense way, it is hard to guess how queries involving comparison operators on fields allowing null values or null query arguments will filter the results, without knowing the exact semantics of the comparison operators with regard to null values.

        It would be great if this could be clarified in the docs.

        Thanks.
        Benjamin Eberlei made changes -
        Workflow jira [ 13061 ] jira-feedback [ 13972 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 13972 ] jira-feedback2 [ 15836 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 15836 ] jira-feedback3 [ 18092 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1405, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Daniel Alvarez Arribas
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: