[
https://issues.apache.org/jira/browse/DERBY-4391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12760894#action_12760894
]
Knut Anders Hatlen commented on DERBY-4391:
-------------------------------------------
It looks like the NPE is thrown if the left side of the set operation has a
column which is not a simple column reference. So the following queries (with
expressions or constants on the left side of the union) fail:
select * from t where a < (select 4 from t except select b from t)
select * from t where a < (select a+b from t except select 4 from t)
select * from t where a < (select a+b from t except select a from t)
select * from t where a < (select sum(a) from t intersect select b from t)
Whereas these don't raise a NPE:
select * from t where a < (select a from t intersect all select b from t)
select * from t where a < (select b from t except select 4 from t)
select * from t where a < (select a from t except select a+b from t)
select * from t where a < (select b from t union select sum(a) from t)
Also worth to notice is that the NPE is not raised if the binary arithmetic
operator is =, only if it is <, >, <= or >=.
> NullPointerException when comparing indexed column with result from a set
> operation
> -----------------------------------------------------------------------------------
>
> Key: DERBY-4391
> URL: https://issues.apache.org/jira/browse/DERBY-4391
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.0.0
> Reporter: Knut Anders Hatlen
>
> I'm reporting this issue on behalf of Bernt M. Johnsen.
> If an indexed column is compared with a UNION query (or some other set
> operation), a NullPointerException is raised, as can be seen by this sequence
> of statements in ij:
> ij> create table t(a int not null primary key, b int);
> 0 rows inserted/updated/deleted
> ij> select * from t where a < (values 4 union values 4);
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.