mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DQL: SELECT EXISTS does not work #5419
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Erikvv on GitHub (Feb 16, 2017).
Originally assigned to: @Ocramius on GitHub.
This is based on valid SQL but I cannot get it to work in DQL. The documentation says EXISTS should work in both WHERE and SELECT.
This gives the error:
[Syntax`` Error] line 0, col 7: Error: Expected known function, got 'EXISTS'EXISTS seems to work like this after WHERE but not in select
There should be an eample in the documentation, or a fix if this is a bug.
@Ocramius commented on GitHub (Feb 16, 2017):
Subqueries in the
SELECTclause are not supported overall. Where did you find examples ofEXISTSused inSELECT? The EBNF doesn't allow it, as far as I can see: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#query-language@Erikvv commented on GitHub (Feb 16, 2017):
D'oh that sound like something I knew but I must have forgotten.
I'm not familiar with EBNF unfortunately. It is a bit hard to use as a reference. Looks like it would be useful to spend some time studying that page.
I was confused by this bit:
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#other-expressions
It notes about functions "The following functions are supported in SELECT, WHERE and HAVING clauses:"
But it notes not any restriction for "Other Expressions"
@Ocramius commented on GitHub (Feb 16, 2017):
@Erikvv the EBNF is really a simple recursive tree of allowed symbols. SQLite has similar docs, for example.
If you are able to improve the documentation on the bit you mentioned, please feel free to send a patch with edits to doctrine-query-language.rst.
Closing as
invalidhere, meanwhile.