[ https://issues.apache.org/jira/browse/DERBY-3321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575330#action_12575330 ]
thomanie edited comment on DERBY-3321 at 3/5/08 4:54 AM: --------------------------------------------------------------- Attaching patch proposal and test extention for this issue. Like Dyres initial analysis shows, we fail to bind the columns of the innermost subquery and end up with an NPE. The patch solves this by checking the fromList for a FromSubquery using a CollectNodesVistior and basing the value of bindTargetListOnly on the contents of the visior. suites.All and derbyAll are running was (Author: thomanie): Attaching patch proposal and test extention for this issue. Like Dyre initial analysis shows, we fail to bind the columns of the innermost subquery and end up with an NPE. The patch solves this by checking the fromList for a FromSubquery using a CollectNodesVistior and basing the value of bindTargetListOnly on the contents of the visior. > NullPointerException for 'NOT EXISTS' with nested subquery > ---------------------------------------------------------- > > Key: DERBY-3321 > URL: https://issues.apache.org/jira/browse/DERBY-3321 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.0.2.1, 10.1.3.1, 10.2.2.0, 10.3.2.1, 10.4.0.0 > Reporter: Jørgen Løland > Assignee: Thomas Nielsen > Priority: Minor > Attachments: d3321.diff, d3321.stat, derby.log > > > Queries with 'not exists' followed by a nested subquery results in NPE: > -----------8<-------------- > connect 'jdbc:derby:testdb;create=true'; > create table a (aa int, bb int); > -- 0 rows inserted/updated/deleted > create table b (bb int); > -- 0 rows inserted/updated/deleted > insert into a values (1, 1), (1, 2), (2, 2); > -- 3 rows inserted/updated/deleted > insert into b values (1); > -- 1 row inserted/updated/deleted > select * from a > where not exists > (select bb from b where a.bb=b.bb); > -- AA |BB > -- ---------------------- > -- 1 |2 > -- 2 |2 > select bb from (select bb from b) p; > -- BB > -- ----------- > -- 1 > select * from a > where not exists > (select bb from (select bb from b) p where a.bb=p.bb); > -- ERROR XJ001: Java exception: ': java.lang.NullPointerException'. > ------------>8---------------- -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.