Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 93608 invoked from network); 16 Mar 2007 10:41:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Mar 2007 10:41:37 -0000 Received: (qmail 44005 invoked by uid 500); 16 Mar 2007 10:41:39 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 43900 invoked by uid 500); 16 Mar 2007 10:41:39 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 43844 invoked by uid 99); 16 Mar 2007 10:41:38 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2007 03:41:38 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2007 03:41:29 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 87AB4714085 for ; Fri, 16 Mar 2007 03:41:09 -0700 (PDT) Message-ID: <540877.1174041669553.JavaMail.jira@brutus> Date: Fri, 16 Mar 2007 03:41:09 -0700 (PDT) From: =?utf-8?Q?Lars_Gr=C3=A5mark_=28JIRA=29?= To: derby-dev@db.apache.org Subject: [jira] Created: (DERBY-2459) Ordering on a CASE-expression casues a NullPointerException when using a UNION MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Ordering on a CASE-expression casues a NullPointerException when using a UN= ION ---------------------------------------------------------------------------= --- Key: DERBY-2459 URL: https://issues.apache.org/jira/browse/DERBY-2459 Project: Derby Issue Type: Bug Components: SQL Affects Versions: 10.2.2.1 Environment: Java 1.5.0_06-b05 on Linux Ubuntu 5.10. Derby version= 10.2.2 Reporter: Lars Gr=C3=A5mark When an order by clause involves a CASE-expression as seen below, a NullPoi= nterException is thrown. The error only occurs when two select statements a= re combined in a union (or union all). select t1.id, CASE WHEN t2.value IS NOT NULL THEN t2.value ELSE t1.value EN= D from A1 t1 left outer join B1 t2 ON t2.id =3D t1.ref union all select t1.id, CASE WHEN t2.value IS NOT NULL THEN t2.value ELSE t1.value EN= D from A2 t1 left outer join B2 t2 ON t2.id =3D 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); --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.