You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "Craig Russell (JIRA)" <ji...@apache.org> on 2005/12/28 03:47:32 UTC

[jira] Created: (JDO-267) Query with alias result generates incorrect SQL

Query with alias result generates incorrect SQL
-----------------------------------------------

         Key: JDO-267
         URL: http://issues.apache.org/jira/browse/JDO-267
     Project: JDO
        Type: Bug
  Components: tck20  
    Reporter: Craig Russell
 Assigned to: Andy Jefferson 


This JDOQL query results in the wrong SQL:
        /*UNIQUE*/      Boolean.FALSE,
        /*RESULT*/      "firstname AS firstName, lastname AS lastName",
        /*INTO*/        FullName.class, 
        /*FROM*/        FullTimeEmployee.class,
        /*EXCLUDE*/     Boolean.TRUE,
        /*WHERE*/       "salary > 1000 & projects.contains(p) & " +
                        "p.budget > limit",
        /*VARIABLES*/   "Project p",
        /*PARAMETERS*/  "BigDecimal limit",
        /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Project; " +
                        "import java.math.BigDecimal",
        /*GROUP BY*/    "firstname, lastname HAVING lastname.startsWith('emp')",
        /*ORDER BY*/    "lastname ASCENDING",
        /*FROM*/        0,
        /*TO*/          3)
001 error:  javax.jdo.JDODataStoreException: Error executing JDOQL query "SELECT DISTINCT THIS.FIRSTNAME AS firstName,THIS.LASTNAME AS lastName,THIS.LASTNAME FROM datastoreidentity0.PERSONS THIS INNER JOIN datastoreidentity0.PROJECT_MEMBER THIS_PROJECTS ON THIS_PROJECTS."MEMBER" = THIS.DATASTORE_IDENTITY INNER JOIN datastoreidentity0.PROJECTS UNBOUND_P ON UNBOUND_P.DATASTORE_IDENTITY = THIS_PROJECTS.PROJID LEFT OUTER JOIN datastoreidentity0.PROJECTS UNBOUND_P_BUDGET ON UNBOUND_P.DATASTORE_IDENTITY = UNBOUND_P_BUDGET.DATASTORE_IDENTITY WHERE THIS.DISCRIMINATOR = ? AND THIS.SALARY > 1000 AND UNBOUND_P_BUDGET.BUDGET > .2E4 GROUP BY THIS.FIRSTNAME,THIS.LASTNAME HAVING LOCATE(?,THIS.LASTNAME) = 1 ORDER BY THIS.LASTNAME" : Column name 'LASTNAME' appears more than once in the result of the query expression.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-267) Query with alias result generates incorrect SQL

Posted by "Andy Jefferson (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-267?page=comments#action_12361314 ] 

Andy Jefferson commented on JDO-267:
------------------------------------

Any clue as to which TCK test this refers to ? The test class name would be nice.

> Query with alias result generates incorrect SQL
> -----------------------------------------------
>
>          Key: JDO-267
>          URL: http://issues.apache.org/jira/browse/JDO-267
>      Project: JDO
>         Type: Bug
>   Components: tck20
>     Reporter: Craig Russell
>     Assignee: Andy Jefferson

>
> This JDOQL query results in the wrong SQL:
>         /*UNIQUE*/      Boolean.FALSE,
>         /*RESULT*/      "firstname AS firstName, lastname AS lastName",
>         /*INTO*/        FullName.class, 
>         /*FROM*/        FullTimeEmployee.class,
>         /*EXCLUDE*/     Boolean.TRUE,
>         /*WHERE*/       "salary > 1000 & projects.contains(p) & " +
>                         "p.budget > limit",
>         /*VARIABLES*/   "Project p",
>         /*PARAMETERS*/  "BigDecimal limit",
>         /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Project; " +
>                         "import java.math.BigDecimal",
>         /*GROUP BY*/    "firstname, lastname HAVING lastname.startsWith('emp')",
>         /*ORDER BY*/    "lastname ASCENDING",
>         /*FROM*/        0,
>         /*TO*/          3)
> 001 error:  javax.jdo.JDODataStoreException: Error executing JDOQL query "SELECT DISTINCT THIS.FIRSTNAME AS firstName,THIS.LASTNAME AS lastName,THIS.LASTNAME FROM datastoreidentity0.PERSONS THIS INNER JOIN datastoreidentity0.PROJECT_MEMBER THIS_PROJECTS ON THIS_PROJECTS."MEMBER" = THIS.DATASTORE_IDENTITY INNER JOIN datastoreidentity0.PROJECTS UNBOUND_P ON UNBOUND_P.DATASTORE_IDENTITY = THIS_PROJECTS.PROJID LEFT OUTER JOIN datastoreidentity0.PROJECTS UNBOUND_P_BUDGET ON UNBOUND_P.DATASTORE_IDENTITY = UNBOUND_P_BUDGET.DATASTORE_IDENTITY WHERE THIS.DISCRIMINATOR = ? AND THIS.SALARY > 1000 AND UNBOUND_P_BUDGET.BUDGET > .2E4 GROUP BY THIS.FIRSTNAME,THIS.LASTNAME HAVING LOCATE(?,THIS.LASTNAME) = 1 ORDER BY THIS.LASTNAME" : Column name 'LASTNAME' appears more than once in the result of the query expression.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (JDO-267) Query with alias result generates incorrect SQL

Posted by "Andy Jefferson (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-267?page=all ]
     
Andy Jefferson resolved JDO-267:
--------------------------------

    Resolution: Fixed

Presuming you're talking about SingleString test.
Now fixed in JPOX CVS - build dated 29/12/2005 or later.

> Query with alias result generates incorrect SQL
> -----------------------------------------------
>
>          Key: JDO-267
>          URL: http://issues.apache.org/jira/browse/JDO-267
>      Project: JDO
>         Type: Bug
>   Components: tck20
>     Reporter: Craig Russell
>     Assignee: Andy Jefferson

>
> This JDOQL query results in the wrong SQL:
>         /*UNIQUE*/      Boolean.FALSE,
>         /*RESULT*/      "firstname AS firstName, lastname AS lastName",
>         /*INTO*/        FullName.class, 
>         /*FROM*/        FullTimeEmployee.class,
>         /*EXCLUDE*/     Boolean.TRUE,
>         /*WHERE*/       "salary > 1000 & projects.contains(p) & " +
>                         "p.budget > limit",
>         /*VARIABLES*/   "Project p",
>         /*PARAMETERS*/  "BigDecimal limit",
>         /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Project; " +
>                         "import java.math.BigDecimal",
>         /*GROUP BY*/    "firstname, lastname HAVING lastname.startsWith('emp')",
>         /*ORDER BY*/    "lastname ASCENDING",
>         /*FROM*/        0,
>         /*TO*/          3)
> 001 error:  javax.jdo.JDODataStoreException: Error executing JDOQL query "SELECT DISTINCT THIS.FIRSTNAME AS firstName,THIS.LASTNAME AS lastName,THIS.LASTNAME FROM datastoreidentity0.PERSONS THIS INNER JOIN datastoreidentity0.PROJECT_MEMBER THIS_PROJECTS ON THIS_PROJECTS."MEMBER" = THIS.DATASTORE_IDENTITY INNER JOIN datastoreidentity0.PROJECTS UNBOUND_P ON UNBOUND_P.DATASTORE_IDENTITY = THIS_PROJECTS.PROJID LEFT OUTER JOIN datastoreidentity0.PROJECTS UNBOUND_P_BUDGET ON UNBOUND_P.DATASTORE_IDENTITY = UNBOUND_P_BUDGET.DATASTORE_IDENTITY WHERE THIS.DISCRIMINATOR = ? AND THIS.SALARY > 1000 AND UNBOUND_P_BUDGET.BUDGET > .2E4 GROUP BY THIS.FIRSTNAME,THIS.LASTNAME HAVING LOCATE(?,THIS.LASTNAME) = 1 ORDER BY THIS.LASTNAME" : Column name 'LASTNAME' appears more than once in the result of the query expression.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-267) Query with alias result generates incorrect SQL

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-267?page=comments#action_12361329 ] 

Craig Russell commented on JDO-267:
-----------------------------------

Sorry, I should have included the full stack trace and identified the test case. 

I decided to open a new JIRA for this issue because the JIRA that had been tracking this test case had changed so many times the original description was no longer descriptive.

Anyway thanks for the comment.

> Query with alias result generates incorrect SQL
> -----------------------------------------------
>
>          Key: JDO-267
>          URL: http://issues.apache.org/jira/browse/JDO-267
>      Project: JDO
>         Type: Bug
>   Components: tck20
>     Reporter: Craig Russell
>     Assignee: Andy Jefferson

>
> This JDOQL query results in the wrong SQL:
>         /*UNIQUE*/      Boolean.FALSE,
>         /*RESULT*/      "firstname AS firstName, lastname AS lastName",
>         /*INTO*/        FullName.class, 
>         /*FROM*/        FullTimeEmployee.class,
>         /*EXCLUDE*/     Boolean.TRUE,
>         /*WHERE*/       "salary > 1000 & projects.contains(p) & " +
>                         "p.budget > limit",
>         /*VARIABLES*/   "Project p",
>         /*PARAMETERS*/  "BigDecimal limit",
>         /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Project; " +
>                         "import java.math.BigDecimal",
>         /*GROUP BY*/    "firstname, lastname HAVING lastname.startsWith('emp')",
>         /*ORDER BY*/    "lastname ASCENDING",
>         /*FROM*/        0,
>         /*TO*/          3)
> 001 error:  javax.jdo.JDODataStoreException: Error executing JDOQL query "SELECT DISTINCT THIS.FIRSTNAME AS firstName,THIS.LASTNAME AS lastName,THIS.LASTNAME FROM datastoreidentity0.PERSONS THIS INNER JOIN datastoreidentity0.PROJECT_MEMBER THIS_PROJECTS ON THIS_PROJECTS."MEMBER" = THIS.DATASTORE_IDENTITY INNER JOIN datastoreidentity0.PROJECTS UNBOUND_P ON UNBOUND_P.DATASTORE_IDENTITY = THIS_PROJECTS.PROJID LEFT OUTER JOIN datastoreidentity0.PROJECTS UNBOUND_P_BUDGET ON UNBOUND_P.DATASTORE_IDENTITY = UNBOUND_P_BUDGET.DATASTORE_IDENTITY WHERE THIS.DISCRIMINATOR = ? AND THIS.SALARY > 1000 AND UNBOUND_P_BUDGET.BUDGET > .2E4 GROUP BY THIS.FIRSTNAME,THIS.LASTNAME HAVING LOCATE(?,THIS.LASTNAME) = 1 ORDER BY THIS.LASTNAME" : Column name 'LASTNAME' appears more than once in the result of the query expression.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira