Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: DQL
    • Labels:
      None

      Description

      Hi, the following query

      public function testIdentityFunctionInSubqueryClause()
      {
          $sql = $this->_em->createQuery(
              "SELECT a
               FROM Doctrine\Tests\Models\CMS\CmsAddress a
               WHERE a.user IN (
                   SELECT IDENTITY(a2.user)
                   FROM Doctrine\Tests\Models\CMS\CmsArticle a2
               )"
          )->getSql();
      }
      

      throws an error:

      1) Doctrine\Tests\ORM\Query\SelectSqlGenerationTest::testIdentityFunctionInSubqueryClause
      Doctrine\ORM\Query\QueryException: [Syntax Error] line 0, col 85: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got '('
      
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/QueryException.php:42
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:380
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:255
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1189
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1280
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2737
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2228
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2145
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2121
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2089
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2064
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1212
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:760
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:727
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:213
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:288
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query.php:231
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query.php:177
      /Users/adrienbrault/Developer/php/mygithub/doctrine2/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php:1375
      

      I think that it's a bug and not a feature, because i tried to reproduce the last example from there http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#dql-select-examples

        Activity

        Adrien Brault created issue -
        Adrien Brault made changes -
        Field Original Value New Value
        Description Hi, the following query

        ```
            public function testIdentityFunctionInSubqueryClause()
            {
                $sql = $this->_em->createQuery(
                    "SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.user IN (SELECT IDENTITYa2.user FROM Doctrine\Tests\Models\CMS\CmsArticle a2)"
                )->getSql();
            }
        ```

        throws an error:

        ```
        1) Doctrine\Tests\ORM\Query\SelectSqlGenerationTest::testIdentityFunctionInSubqueryClause
        Doctrine\ORM\Query\QueryException: [Syntax Error] line 0, col 85: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got '('

        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/QueryException.php:42
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:380
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:255
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1189
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1280
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2737
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2228
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2145
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2121
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2089
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2064
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1212
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:760
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:727
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:213
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:288
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query.php:231
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query.php:177
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php:1375
        ```
        Hi, the following query

        {code}
        public function testIdentityFunctionInSubqueryClause()
        {
            $sql = $this->_em->createQuery(
                "SELECT a
                 FROM Doctrine\Tests\Models\CMS\CmsAddress a
                 WHERE a.user IN (
                     SELECT IDENTITYa2.user
                     FROM Doctrine\Tests\Models\CMS\CmsArticle a2
                 )"
            )->getSql();
        }
        {code}

        throws an error:

        {code}
        1) Doctrine\Tests\ORM\Query\SelectSqlGenerationTest::testIdentityFunctionInSubqueryClause
        Doctrine\ORM\Query\QueryException: [Syntax Error] line 0, col 85: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got '('

        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/QueryException.php:42
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:380
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:255
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1189
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1280
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2737
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2228
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2145
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2121
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2089
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2064
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1212
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:760
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:727
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:213
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:288
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query.php:231
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query.php:177
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php:1375
        {code}

        I think that it's a bug and not a feature, because i tried to reproduce the last example from there http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#dql-select-examples
        Adrien Brault made changes -
        Description Hi, the following query

        {code}
        public function testIdentityFunctionInSubqueryClause()
        {
            $sql = $this->_em->createQuery(
                "SELECT a
                 FROM Doctrine\Tests\Models\CMS\CmsAddress a
                 WHERE a.user IN (
                     SELECT IDENTITYa2.user
                     FROM Doctrine\Tests\Models\CMS\CmsArticle a2
                 )"
            )->getSql();
        }
        {code}

        throws an error:

        {code}
        1) Doctrine\Tests\ORM\Query\SelectSqlGenerationTest::testIdentityFunctionInSubqueryClause
        Doctrine\ORM\Query\QueryException: [Syntax Error] line 0, col 85: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got '('

        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/QueryException.php:42
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:380
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:255
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1189
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1280
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2737
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2228
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2145
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2121
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2089
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2064
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1212
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:760
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:727
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:213
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:288
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query.php:231
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query.php:177
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php:1375
        {code}

        I think that it's a bug and not a feature, because i tried to reproduce the last example from there http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#dql-select-examples
        Hi, the following query

        {code}
        public function testIdentityFunctionInSubqueryClause()
        {
            $sql = $this->_em->createQuery(
                "SELECT a
                 FROM Doctrine\Tests\Models\CMS\CmsAddress a
                 WHERE a.user IN (
                     SELECT IDENTITY(a2.user)
                     FROM Doctrine\Tests\Models\CMS\CmsArticle a2
                 )"
            )->getSql();
        }
        {code}

        throws an error:

        {code}
        1) Doctrine\Tests\ORM\Query\SelectSqlGenerationTest::testIdentityFunctionInSubqueryClause
        Doctrine\ORM\Query\QueryException: [Syntax Error] line 0, col 85: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got '('

        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/QueryException.php:42
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:380
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:255
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1189
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1280
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2737
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2228
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2145
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2121
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2089
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:2064
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:1212
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:760
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:727
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:213
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query/Parser.php:288
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query.php:231
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/lib/Doctrine/ORM/Query.php:177
        /Users/adrienbrault/Developer/php/mygithub/doctrine2/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php:1375
        {code}

        I think that it's a bug and not a feature, because i tried to reproduce the last example from there http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#dql-select-examples
        Adrien Brault made changes -
        Affects Version/s 2.3 [ 10185 ]
        Hide
        Alexander added a comment -

        This is related to http://www.doctrine-project.org/jira/browse/DDC-1557. It seems the fix was not backported to 2.2.

        Show
        Alexander added a comment - This is related to http://www.doctrine-project.org/jira/browse/DDC-1557 . It seems the fix was not backported to 2.2.
        Fabio B. Silva made changes -
        Status Open [ 1 ] Awaiting Feedback [ 10000 ]
        Hide
        Marco Pivetta added a comment - - edited

        Adrien Brault does it work for you in 2.3?

        Show
        Marco Pivetta added a comment - - edited Adrien Brault does it work for you in 2.3?
        Benjamin Eberlei made changes -
        Status Awaiting Feedback [ 10000 ] Open [ 1 ]
        Hide
        Benjamin Eberlei added a comment -

        Duplicate of DDC-1557

        Show
        Benjamin Eberlei added a comment - Duplicate of DDC-1557
        Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Duplicate [ 3 ]

        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-2023, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Adrien Brault
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: