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

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

The reference manual says that subqueries are not allowed in the FROM clause. 
http://db.apache.org/derby/docs/10.4/ref/rrefsqlj41360.html#rrefsqlj41360__sqlj15384

But the code doesn't allow subqueries in the WHERE clause either. See 
SelectNode.isUpdatableCursor() which contains this code:

                if ((getWhereSubquerys() != null) &&
                        (getWhereSubquerys().size() != 0))
                {
                        if (SanityManager.DEBUG)
                        SanityManager.DEBUG("DumpUpdateCheck","cursor select 
has subquery in WHERE clause");
                        return false;
                }

I'm not sure if just removing this check would actually make the query work, 
though, or if it would work for all queries with a subquery in the WHERE 
clause. Anyway, if we don't allow subqueries in WHERE clauses, the 
documentation should say so.

> 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
>            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