Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 35F2D49B6 for ; Fri, 10 Jun 2011 16:33:20 +0000 (UTC) Received: (qmail 41191 invoked by uid 500); 10 Jun 2011 16:33:20 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 41165 invoked by uid 500); 10 Jun 2011 16:33:20 -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 41158 invoked by uid 99); 10 Jun 2011 16:33:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2011 16:33:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2011 16:33:18 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id BC52110D179 for ; Fri, 10 Jun 2011 16:32:58 +0000 (UTC) Date: Fri, 10 Jun 2011 16:32:58 +0000 (UTC) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Message-ID: <840318252.11094.1307723578768.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (DERBY-4779) NPE while inserting into a table which has a generated column and an insert trigger MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-4779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047276#comment-13047276 ] Rick Hillegas commented on DERBY-4779: -------------------------------------- Thanks for the patch, Siddharth. It looks good to me. Just needs a regression test case--you might want to add a test case to GeneratedColumnsTest. Thanks! > NPE while inserting into a table which has a generated column and an insert trigger > ----------------------------------------------------------------------------------- > > Key: DERBY-4779 > URL: https://issues.apache.org/jira/browse/DERBY-4779 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.5.3.0, 10.6.1.0, 10.7.1.1 > Reporter: Rick Hillegas > Assignee: Siddharth Srivastava > Labels: derby_triage10_8 > Attachments: d4779.diff > > > The following script generates an NPE on the concluding insert: > connect 'jdbc:derby:memory:dummy;create=true'; > create function getRegion( v int ) > returns varchar( 20 ) > language java parameter style java deterministic no sql > external name 'java.lang.Integer.toString' > ; > create table orders > ( > orderID bigint primary key, > salesPrice int not null, > region generated always as ( getRegion( salesPrice ) ) > ) > ; > create table dummy( a int ); > create trigger newOrderTrigger > after insert on orders > for each row > insert into dummy( a ) values ( 1 ) > ; > insert into orders( orderID, salesPrice ) values ( 1, 2 ) > ; > ------------------------ > Here is the NPE: > java.lang.NullPointerException > at org.apache.derby.impl.sql.execute.DMLWriteResultSet.objectifyStreams(Unknown Source) > at org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(Unknown Source) > at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source) > at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source) > at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) > at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source) > at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source) > at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source) > at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source) > at org.apache.derby.impl.tools.ij.Main.go(Unknown Source) > at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source) > at org.apache.derby.impl.tools.ij.Main.main(Unknown Source) > at org.apache.derby.tools.ij.main(Unknown Source) -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira