[
https://issues.apache.org/jira/browse/DERBY-5954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13480040#comment-13480040
]
Dag H. Wanvik edited comment on DERBY-5954 at 10/19/12 2:22 PM:
----------------------------------------------------------------
Uploading patch derby-5954, which is a simple one-line patch that makes the
row_number variants work, i.e.
it will work as "well" as the table select with similar nesting/correlated
query above. I'll address the "0" instead of null in another issue (DERBY-5957).
The issue was the following: when looking for in-line window definitions in the
select list, the visitor looked to deep: it should not move into subqueries in
the select list. This error caused the query tree to become seriously garbled,
hence the NPE and the assert seen.
Still need to add a JUnit test, so not for commit yet.
was (Author: dagw):
Uploading patch derby-5954, which is a simple one-line patch that makes the
row_number variants work, i.e.
it will work as "well" as the table select with similar nesting/correlated
query above. I'll address the "0" instead of null in another issue.
The issue was the following: when looking for in-line window definitions in the
select list, the visitor looked to deep: it should not move into subqueries in
the select list. This error caused the query tree to become seriously garbled,
hence the NPE and the assert seen.
Still need to add a JUnit test, so not for commit yet.
> NPE in SELECT involving subselects and windows functions
> --------------------------------------------------------
>
> Key: DERBY-5954
> URL: https://issues.apache.org/jira/browse/DERBY-5954
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.6.1.0, 10.6.2.1, 10.7.1.1, 10.8.1.2, 10.8.2.2,
> 10.9.1.0
> Reporter: Rick Hillegas
> Assignee: Dag H. Wanvik
> Attachments: derby-5954.diff
>
>
> A user reports and I have verified an NPE on the following SELECT:
> connect 'jdbc:derby:memory:db;create=true';
> create table blah ( a int );
> insert into blah values (1), (2), (3), (4), (5), (6), (7);
> SELECT rn, (SELECT rn FROM (SELECT row_number() over() rn FROM blah ) as T2
> where T2.rn = T1.rn+1) rn2
> FROM (SELECT row_number() over() rn from blah) as T1;
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira