Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 33214 invoked from network); 28 Oct 2006 16:16:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Oct 2006 16:16:26 -0000 Received: (qmail 97199 invoked by uid 500); 28 Oct 2006 16:16:36 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 97155 invoked by uid 500); 28 Oct 2006 16:16:36 -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 97141 invoked by uid 99); 28 Oct 2006 16:16:36 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Oct 2006 09:16:36 -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; Sat, 28 Oct 2006 09:16:22 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C68457142D1 for ; Sat, 28 Oct 2006 09:15:17 -0700 (PDT) Message-ID: <17933766.1162052117810.JavaMail.root@brutus> Date: Sat, 28 Oct 2006 09:15:17 -0700 (PDT) From: "Bryan Pendleton (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-2008) NullPointerException with 2-argument SUBSTR() call in GROUP BY clause. In-Reply-To: <2861051.1161901876507.JavaMail.root@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 [ http://issues.apache.org/jira/browse/DERBY-2008?page=comments#action_12445387 ] Bryan Pendleton commented on DERBY-2008: ---------------------------------------- Hi Yip, I was just wondering: I see that TernaryOperatorNode is used for a few other cases, besides just SUBSTR: TRIM, LOCATE, LIKE, TIMESTAMPADD, and TIMESTAMPDIFF all seem to be TernaryOperatorNodes. How does your patch affect the behavior of these functions? I suppose that if it had any affect at all, it would be to prevent similar NPE bugs when one of these functions was used in an way which provoked an isEquivalent() call for a case where the RHS of the Ternary was NULL. I think the patch is fine, I'm just wondering whether it fixes any more problems than just the SUBSTR-in-a-GROUP-BY case that is noted in the description. > NullPointerException with 2-argument SUBSTR() call in GROUP BY clause. > ---------------------------------------------------------------------- > > Key: DERBY-2008 > URL: http://issues.apache.org/jira/browse/DERBY-2008 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.2.1.6, 10.3.0.0 > Reporter: A B > Assigned To: Yip Ng > Priority: Minor > Attachments: derby2008-trunk-diff01.txt, derby2008-trunk-stat01.txt > > > The following query, which fails with a syntax error in 10.1.3 (because functions are not allowed in a GROUP BY expression for 10.1) fails with a NullPointerException in 10.2 and in the codeline (10.3): > create table dt (vc varchar(30)); > insert into dt values ('1928-09-21'), ('1903-12-08'); > select substr(vc, 3) from dt group by substr(vc, 3); > Result (on trunk) is: > java.lang.NullPointerException > at org.apache.derby.impl.sql.compile.TernaryOperatorNode.isEquivalent(TernaryOperatorNode.java:924) > at org.apache.derby.impl.sql.compile.GroupByList.findGroupingColumn(GroupByList.java:244) > at org.apache.derby.impl.sql.compile.VerifyAggregateExpressionsVisitor.skipChildren(VerifyAggregateExpressionsVisitor.java:146) > at org.apache.derby.impl.sql.compile.TernaryOperatorNode.accept(TernaryOperatorNode.java:497) > at org.apache.derby.impl.sql.compile.ResultColumn.accept(ResultColumn.java:1515) > at org.apache.derby.impl.sql.compile.QueryTreeNodeVector.accept(QueryTreeNodeVector.java:159) > at org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(SelectNode.java:619) > at org.apache.derby.impl.sql.compile.FromSubquery.bindExpressions(FromSubquery.java:262) > at org.apache.derby.impl.sql.compile.FromList.bindExpressions(FromList.java:337) > at org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(SelectNode.java:500) > 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) > at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:745) > at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:568) > at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:517) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira