Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1530

HIDDEN values cannot be used in WhereClause

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Git Master
    • Fix Version/s: 2.x
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      SELECT  u, u.name AS HIDDEN n FROM User u WHERE n = ?1
      

      Is broken. Error:

      SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sclr16' in 'where clause
      

      On a query like:

      SELECT s0_.id AS id0, s0_.a AS a1, s0_.b AS b2, s0_.c AS c3, s0_.d AS d4, s0_.e AS e5, s0_.f AS f6, s0_.g AS g7, s0_.h AS h8, s0_.i AS i9, s0_.j AS j10, s0_.k AS k11, s0_.l AS l12, s0_.m AS m13, s0_.n AS n14, s0_.o AS o15, 123456789 AS sclr16, s0_.p AS p17 FROM myEntity s0_ WHERE s0_.a = 1 AND sclr16 <= ? ORDER BY sclr16 ASC 
      

        Activity

        Guilherme Blanco created issue -
        Hide
        Guilherme Blanco added a comment -

        Updating fix version

        Show
        Guilherme Blanco added a comment - Updating fix version
        Guilherme Blanco made changes -
        Field Original Value New Value
        Fix Version/s 2.x [ 10090 ]
        Fix Version/s 2.2 [ 10157 ]
        Hide
        Christian Raue added a comment -

        It occurs even if the value is not HIDDEN.

        Show
        Christian Raue added a comment - It occurs even if the value is not HIDDEN.
        Hide
        Benjamin Eberlei added a comment -

        @Christian this sounds like a completly different error, please explain why you think this belongs here or open a new ticket.

        Show
        Benjamin Eberlei added a comment - @Christian this sounds like a completly different error, please explain why you think this belongs here or open a new ticket.
        Hide
        Christian Raue added a comment -

        Benjamin: Because I get exactly the same error message regardless of using HIDDEN. So HIDDEN doesn't seem to be liable here.

        Show
        Christian Raue added a comment - Benjamin: Because I get exactly the same error message regardless of using HIDDEN. So HIDDEN doesn't seem to be liable here.
        Hide
        Benjamin Eberlei added a comment -

        Can you paste your DQL and SQL?

        Show
        Benjamin Eberlei added a comment - Can you paste your DQL and SQL?
        Hide
        Christian Raue added a comment - - edited

        Code:

        $queryBuilder
        	->select('myEntity, 123456789 AS distance')
        	->where('distance <= 10')
        ;
        

        DQL:

        SELECT myEntity, 123456789 AS distance FROM MyCompany\MyBundle\Entity\MyEntity myEntity WHERE distance <= 10
        

        SQL:

        SELECT s0_.id AS id0, s0_.a AS a1, s0_.b AS b2, s0_.c AS c3, s0_.d AS d4, s0_.e AS e5, s0_.f AS f6, s0_.g AS g7, s0_.h AS h8, s0_.i AS i9, s0_.j AS j10, s0_.k AS k11, s0_.l AS l12, s0_.m AS m13, s0_.n AS n14, s0_.o AS o15, 123456789 AS sclr16, s0_.p AS p17 FROM myEntity s0_ WHERE sclr16 <= 10
        
        Show
        Christian Raue added a comment - - edited Code: $queryBuilder ->select('myEntity, 123456789 AS distance') ->where('distance <= 10') ; DQL: SELECT myEntity, 123456789 AS distance FROM MyCompany\MyBundle\Entity\MyEntity myEntity WHERE distance <= 10 SQL: SELECT s0_.id AS id0, s0_.a AS a1, s0_.b AS b2, s0_.c AS c3, s0_.d AS d4, s0_.e AS e5, s0_.f AS f6, s0_.g AS g7, s0_.h AS h8, s0_.i AS i9, s0_.j AS j10, s0_.k AS k11, s0_.l AS l12, s0_.m AS m13, s0_.n AS n14, s0_.o AS o15, 123456789 AS sclr16, s0_.p AS p17 FROM myEntity s0_ WHERE sclr16 <= 10
        Hide
        Benjamin Eberlei added a comment -

        That is expected behavior, ANSI SQL defines SELECT to be evaluated AFTER WHERE.

        SELECT 1234 AS foo FROM `test` HAVING foo = 1234
        

        DQL has a HAVING clause as well, not sure it works without the group by. Please try.

        Show
        Benjamin Eberlei added a comment - That is expected behavior, ANSI SQL defines SELECT to be evaluated AFTER WHERE. SELECT 1234 AS foo FROM `test` HAVING foo = 1234 DQL has a HAVING clause as well, not sure it works without the group by. Please try.
        Hide
        Christian Raue added a comment -

        So we might just close this issue then?

        Show
        Christian Raue added a comment - So we might just close this issue then?
        Hide
        Benjamin Eberlei added a comment -

        Its not a bug, just the error message is supposed to be improved (if possible) in a cheap way.

        Show
        Benjamin Eberlei added a comment - Its not a bug, just the error message is supposed to be improved (if possible) in a cheap way.
        Benjamin Eberlei made changes -
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Priority Critical [ 2 ] Major [ 3 ]
        Component/s DQL [ 10014 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 13254 ] jira-feedback [ 13996 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 13996 ] jira-feedback2 [ 15860 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 15860 ] jira-feedback3 [ 18116 ]

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

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Guilherme Blanco
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: