[DDC-2023] IDENTITY() in subquery throws error Created: 11/Sep/12 Updated: 14/Apr/13 Resolved: 14/Apr/13 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Adrien Brault | Assignee: | Benjamin Eberlei |
| Resolution: | Duplicate | Votes: | 0 |
| 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 |
| Comments |
| Comment by Alexander [ 11/Sep/12 ] |
|
This is related to http://www.doctrine-project.org/jira/browse/DDC-1557. It seems the fix was not backported to 2.2. |
| Comment by Marco Pivetta [ 23/Jan/13 ] |
|
Adrien Brault does it work for you in 2.3? |
| Comment by Benjamin Eberlei [ 14/Apr/13 ] |
|
Duplicate of |