[ 
https://issues.apache.org/jira/browse/DERBY-4045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12669710#action_12669710
 ] 

Knut Anders Hatlen commented on DERBY-4045:
-------------------------------------------

I tried to remove the check, and the query in the description of the issue 
worked fine, and I could use positioned updates on the cursor. However, with 
other queries it failed when I tried to do the positioned update:

ij> get cursor c as 'select * from t1 where x in (select x from t1) for update';
ij> next c;
X          |Y         
----------------------
1          |one       
ij> next c;
X          |Y         
----------------------
2          |two       
ij> update t1 set y = 'asdfa' where current of c;
ERROR XJ001: Java exception: 'ASSERT FAILED Join used in positioned 
update/delete: org.apache.derby.shared.common.sanity.AssertFailure'.

So the problem with subqueries in WHERE clauses appears to be that the 
optimizer may choose to rewrite the query to a join, and Derby doesn't have 
updatable joins.

> Subquery causes error: 'updateString' not allowed because the ResultSet is 
> not an updatable ResultSet
> -----------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4045
>                 URL: https://issues.apache.org/jira/browse/DERBY-4045
>             Project: Derby
>          Issue Type: Bug
>          Components: Documentation, SQL
>            Reporter: John T. Dow
>
> Embedded Derby (don't know about client) demoted an updatable result set 
> apparently due to a nested query.
> select * from orders where (orders.recordno = (select max(orders.recordno) 
> from orders))
> Fix if possible. 
> If it can't be fixed, the documentation should be changed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to