Skip to content

Loading…

DDC-2023: IDENTITY() in subquery throws error #2700

Closed
doctrinebot opened this Issue · 4 comments

2 participants

@doctrinebot

Jira issue originally created by user adrienbrault:

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

@doctrinebot

Comment created by @asm89:

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

@doctrinebot

Comment created by @ocramius:

[~adrienbrault] does it work for you in 2.3?

@doctrinebot

Comment created by @beberlei:

Duplicate of DDC-1557

@doctrinebot

Issue was closed with resolution "Duplicate"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.