[
https://issues.apache.org/jira/browse/DERBY-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
A B updated DERBY-2459:
-----------------------
Affects Version/s: 10.3.0.0
10.1.3.2
10.1.3.1
10.2.1.6
10.2.2.0
I confirmed this bug with ibm142 against the latest trunk with the following
stack trace:
java.lang.NullPointerException
at
org.apache.derby.impl.sql.compile.OrderByColumn.bindOrderByColumn(OrderByColumn.java:179)
at
org.apache.derby.impl.sql.compile.OrderByList.bindOrderByColumns(OrderByList.java:153)
at
org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:266)
at
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:314)
at
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:741)
at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:567)
at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:516)
at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:320)
at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:516)
at
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:369)
at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:267)
at org.apache.derby.impl.tools.ij.Main.go(Main.java:203)
at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:169)
at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
at org.apache.derby.tools.ij.main(ij.java:71)
I also ran it against 10.1 and the same problem occurs there. So I'm adding a
couple of entries to the "Affects version" box.
Thank you for filing this issue, Lars.
> Ordering on a CASE-expression casues a NullPointerException when using a UNION
> ------------------------------------------------------------------------------
>
> Key: DERBY-2459
> URL: https://issues.apache.org/jira/browse/DERBY-2459
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.1.3.1, 10.1.3.2, 10.2.1.6, 10.2.2.0, 10.2.2.1,
> 10.3.0.0
> Environment: Java 1.5.0_06-b05 on Linux Ubuntu 5.10. Derby version
> 10.2.2
> Reporter: Lars Gråmark
>
> When an order by clause involves a CASE-expression as seen below, a
> NullPointerException is thrown. The error only occurs when two select
> statements are combined in a union (or union all).
> select t1.id, CASE WHEN t2.value IS NOT NULL THEN t2.value ELSE t1.value END
> from A1 t1
> left outer join B1 t2 ON t2.id = t1.ref
> union all
> select t1.id, CASE WHEN t2.value IS NOT NULL THEN t2.value ELSE t1.value END
> from A2 t1
> left outer join B2 t2 ON t2.id = t1.ref
> order by CASE WHEN t2.value IS NOT NULL THEN t2.value ELSE t1.value END
> --Use the following statement to reproduce the problem:
> create table A1
> (
> id char(1)
> ,value int
> ,ref char(1)
> );
> create table A2
> (
> id char(1)
> ,value int
> ,ref char(1)
> );
> create table B1
> (
> id char(1)
> ,value int
> );
> create table B2
> (
> id char(1)
> ,value int
> );
> insert into A1 (id, value, ref) values ('a', 12, 'e');
> insert into A1 (id, value, ref) values ('b', 1, null);
> insert into A2 (id, value, ref) values ('c', 3, 'g');
> insert into A2 (id, value, ref) values ('d', 8, null);
> insert into B1 (id, value) values ('e', 4);
> insert into B1 (id, value) values ('f', 2);
> insert into B2 (id, value) values ('g', 5);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.