Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 12718 invoked from network); 21 Feb 2007 21:36:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Feb 2007 21:36:27 -0000 Received: (qmail 34388 invoked by uid 500); 21 Feb 2007 21:36:35 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 34348 invoked by uid 500); 21 Feb 2007 21:36:35 -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 34338 invoked by uid 99); 21 Feb 2007 21:36:35 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Feb 2007 13:36:34 -0800 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; Wed, 21 Feb 2007 13:36:25 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C535F7141E2 for ; Wed, 21 Feb 2007 13:36:05 -0800 (PST) Message-ID: <4984898.1172093765804.JavaMail.jira@brutus> Date: Wed, 21 Feb 2007 13:36:05 -0800 (PST) From: "Yip Ng (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-2218) Null Pointer Exception when an untyped NULL subquery ("values null") appears outside of the FROM list in a SELECT query. In-Reply-To: <12977035.1168037547734.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-2218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474837 ] Yip Ng commented on DERBY-2218: ------------------------------- Sure, Army, I will port it to 10.2 and 10.1. > Null Pointer Exception when an untyped NULL subquery ("values null") appears outside of the FROM list in a SELECT query. > ------------------------------------------------------------------------------------------------------------------------ > > Key: DERBY-2218 > URL: https://issues.apache.org/jira/browse/DERBY-2218 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.1.3.2, 10.2.2.1, 10.2.3.0, 10.3.0.0 > Reporter: A B > Assigned To: Yip Ng > Priority: Minor > Fix For: 10.3.0.0 > > Attachments: derby2218-trunk-diff01.txt, derby2218-trunk-diff02.txt, derby2218-trunk-diff03.txt, derby2218-trunk-stat01.txt, derby2218-trunk-stat02.txt, derby2218-trunk-stat03.txt > > > If a SELECT query contains a subquery which includes an untyped NULL value at any place other than in the FROM list, Derby will throw an NPE at bind time. > ij> create table t1 (i int); > 0 rows inserted/updated/deleted > -- If the untyped NULL is in the FROM list, a reasonable error is thrown. > ij> select * from (values null) x; > ERROR 42X07: Null is only allowed in a VALUES clause within an INSERT statement. > ij> select * from (select * from t1, (values null) x )y; > ERROR 42X07: Null is only allowed in a VALUES clause within an INSERT statement. > -- But if it appears anywhere else, the result is an NPE: > -- IN-list > ij> select * from t1 where i in (1, 2, (values null)); > ERROR XJ001: Java exception: ': java.lang.NullPointerException'. > -- where clause > select * from t1 where (values null); > -- order by clause > select * from t1 order by (values null); > -- result column > select (values null) from t1; > -- group by clause (only works in 10.2 and later) > select * from t1 group by (values null); > -- having clause > select * from t1 group by i having (values null); > Stack trace (from 10.2.2) is: > java.lang.NullPointerException > at org.apache.derby.impl.sql.compile.SubqueryNode.setDataTypeServices(SubqueryNode.java:2289) > at org.apache.derby.impl.sql.compile.SubqueryNode.bindExpression(SubqueryNode.java:529) > at org.apache.derby.impl.sql.compile.ValueNodeList.bindExpression(ValueNodeList.java:130) > at org.apache.derby.impl.sql.compile.BinaryListOperatorNode.bindExpression(BinaryListOperatorNode.java:161) > at org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(SelectNode.java:540) > at org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions(DMLStatementNode.java:249) > at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:162) > at org.apache.derby.impl.sql.compile.CursorNode.bind(CursorNode.java:253) > at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:345) > at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:119) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.