[
https://issues.apache.org/jira/browse/DERBY-4397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798625#action_12798625
]
Dag H. Wanvik commented on DERBY-4397:
--------------------------------------
Thanks for looking at this, Bryan! No, I didn't try to make sortRequired go
through VirtualColumnNode, since
I think its presence was an accident in this particular case, cf. the rewrite I
mention above. Now, there may now (after adding order by in subqueries) be
other use cases where going through the VCN would be valid, so I'll have a look.
Even with the above suggested fix, I still need to solve the redundant sort
incurred in this silly query:
select * from (select i from t order by i) t order by i
The outer order by doesn't yet get the fact the the subquery already has done
the job. Maybe your idea can help solve this case. Btw, solution b) above did
not set off any regression errors, so it seems safe.
> Allow ORDER BY in subqueries
> ----------------------------
>
> Key: DERBY-4397
> URL: https://issues.apache.org/jira/browse/DERBY-4397
> Project: Derby
> Issue Type: Improvement
> Components: SQL
> Reporter: Dag H. Wanvik
> Assignee: Dag H. Wanvik
> Attachments: derby-4397-1.diff, derby-4397-1.stat, derby-4397-2.diff,
> derby-4397-2.stat, derby-4397-all-subqueries.diff,
> derby-4397-all-subqueries.stat, derby-4397-insert-from-exists.diff,
> derby-4397-insert-from-exists.stat, orderBySpec.html, orderBySpec.html,
> orderBySpec.html, orderBySpec.html, orderBySpec.html
>
>
> SQL 2008 allows ORDER BY to be specified in subqueries. In conjunction with
> OFFSET/FETCH and/or ROW_NUMBER
> meaningful subqueries with row ordering may be formulated. Cf. MySQL's LIMIT
> may be used in subqueries as well.
> Note that OFFSET/FETCH is currently not allowed in subqueries, either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.