Issue Details (XML | Word | Printable)

Key: OPENJPA-53
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: George Hongell
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenJPA

bad sql pushdown for nested subselects, missing nested subselect

Created: 19/Sep/06 01:20 AM   Updated: 01/Mar/07 02:20 AM
Return to search
Component/s: query
Affects Version/s: None
Fix Version/s: 0.9.7

Time Tracking:
Not Specified

File Attachments:
  Size
Java Archive File Licensed for inclusion in ASF works failureEntities.jar 2006-09-20 01:52 AM George Hongell 7 kB
Environment: Windows xp, derby, db2

Resolution Date: 01/Mar/07 02:20 AM


 Description  « Hide
536 bad sql pushdown for nested subselects
 TEST536; select e from EmpBean e where (e.salary = (select max(e.salary) from EmpBean e where e.salary > some (select f.salary from EmpBean f where f.dept.mgr.empid=e.dept.mgr.empid)) )
Syntax error: Encountered ")" at line 1, column 504. {SELECT t0.empid, t0.bonus, t5.deptno, t5.budget, t5.name, t0.execLevel, t0.hireDate, t0.hireTime, t0.hireTimestamp, t7.street, t7.city, t7.state, t7.zip, t0.isManager, t0.name, t0.salary, t8.street, t8.city, t8.state, t8.zip FROM EmpBean t0 LEFT OUTER JOIN DeptBean t5 ON t0.dept_deptno = t5.deptno LEFT OUTER JOIN AddressBean t7 ON t0.home_street = t7.street LEFT OUTER JOIN AddressBean t8 ON t0.work_street = t8.street WHERE (t0.salary = (SELECT MAX(t1.salary) FROM EmpBean t1 WHERE (t1.salary > ANY(()))))} [code=30000, state=42X01]
s/b
select q1."EMPID", q1."SALARY", q1."DEPT_DEPTNO" from EMPVO q1 where ( q1."SALARY" = ( select max( q2."SALARY") from EMPVO q2, DEPTVO q3, EMPVO q4 where ( q2."SALARY" > ANY ( select q5."SALARY" from EMPVO q5, DEPTVO q6, EMPVO q7 where ( q7."EMPID" = q4."EMPID") and ( q6."DEPTNO" = q5."DEPT_DEPTNO") and ( q7."EMPID" = q6."MGR_EMPID") ) ) and ( q3."DEPTNO" = q2."DEPT_DEPTNO") and ( q4."EMPID" = q3."MGR_EMPID") ) )

  [ FAILED 536- bucket = fvtfull, query = select e from EmpBean e where (e.salary = (select max(e.salary) from EmpBean e where e.salary > some (select f.salary from EmpBean f where f.dept.mgr.empid=e.dept.mgr.empid)) ) :
   DIFFERENCE-locations based on expected-(
diff at line 2 position 295 EXPECTED [ ] ACTUAL [e]
                                                                                                                                                                                                                                                                                                                                      e
                                                                                                                                                                                                                                                                                                      e
)
   EXPECTED(
 TEST536; select e from EmpBean e where (e.salary = (select max(e.salary) from EmpBean e where e.salary > some (select f.salary from EmpBean f where f.dept.mgr.empid=e.dept.mgr.empid)) )
                                                                                                                                                                                                                                                                                                                                      e
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: );E (t1.salary > ANY((;<query_expr_body> {prepstmnt 605037584 SELECT t0.empid, t0.bonus, t5.deptno, t5.budget, t5.name, t0.execLevel, t0.hireDate, t0.hireTime, t0.hireTimestamp, t7.street, t7.city, t7.state, t7.zip, t0.isManager, t0.name, t0.salary, t8.street, t8.city, t8.state, t8.zip FROM EmpBean t0 LEFT OUTER JOIN DeptBean t5 ON t0.dept_deptno = t5.deptno LEFT OUTER JOIN AddressBean t7 ON t0.home_street = t7.street LEFT OUTER JOIN AddressBean t8 ON t0.work_street = t8.street WHERE (t0.salary = (SELECT MAX(t1.salary) FROM EmpBean t1 WHERE (t1.salary > ANY(()))))} [code=-104, state=42601]
 TEST536; 1 tuple)
   ACTUAL(
 TEST536; select e from EmpBean e where (e.salary = (select max(e.salary) from EmpBean e where e.salary > some (select f.salary from EmpBean f where f.dept.mgr.empid=e.dept.mgr.empid)) )
                                                                                                                                                                                                                                                                                                      e
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Syntax error: Encountered ")" at line 1, column 504. {SELECT t0.empid, t0.bonus, t5.deptno, t5.budget, t5.name, t0.execLevel, t0.hireDate, t0.hireTime, t0.hireTimestamp, t7.street, t7.city, t7.state, t7.zip, t0.isManager, t0.name, t0.salary, t8.street, t8.city, t8.state, t8.zip FROM EmpBean t0 LEFT OUTER JOIN DeptBean t5 ON t0.dept_deptno = t5.deptno LEFT OUTER JOIN AddressBean t7 ON t0.home_street = t7.street LEFT OUTER JOIN AddressBean t8 ON t0.work_street = t8.street WHERE (t0.salary = (SELECT MAX(t1.salary) FROM EmpBean t1 WHERE (t1.salary > ANY(()))))} [code=30000, state=42X01]
 TEST536; 1 tuple) ]



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
George Hongell made changes - 20/Sep/06 01:52 AM
Field Original Value New Value
Attachment failureEntities.jar [ 12341174 ]
David Wisneski made changes - 01/Feb/07 01:26 AM
Status Open [ 1 ] Closed [ 6 ]
Resolution Fixed [ 1 ]
Patrick Linskey made changes - 01/Mar/07 02:17 AM
Resolution Fixed [ 1 ]
Status Closed [ 6 ] Reopened [ 4 ]
Patrick Linskey made changes - 01/Mar/07 02:18 AM
Fix Version/s 0.9.7 [ 12312340 ]
Patrick Linskey made changes - 01/Mar/07 02:20 AM
Status Reopened [ 4 ] Closed [ 6 ]
Resolution Fixed [ 1 ]