db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] Created: (DERBY-3718) NPE when firing a trigger
Date Tue, 10 Jun 2008 18:19:45 GMT
NPE when firing a trigger
-------------------------

                 Key: DERBY-3718
                 URL: https://issues.apache.org/jira/browse/DERBY-3718
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.4.1.3, 10.5.0.0
            Reporter: Rick Hillegas


NullPointerException raised when firing a trigger. Originally reported by Thiyagu P on the
Derby user list: http://www.nabble.com/Trigger-function-broken-in-10.4.1.3--td17760208.html#a17760208
Thiyagu reports that the same script works fine in 10.3.3.0. Here's the script:

CREATE TABLE TRADE(
      ID INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1000),
      BUYID INT NOT NULL,
      QTY FLOAT(2) NOT NULL
   );
  
   CREATE TABLE TOTAL(BUYID INT NOT NULL, TOTALQTY FLOAT(2) NOT NULL);

   CREATE TRIGGER TRADE_INSERT
     AFTER INSERT ON TRADE
     REFERENCING NEW AS NEWROW
     FOR EACH ROW MODE DB2SQL
     UPDATE TOTAL SET TOTALQTY = NEWROW.QTY WHERE BUYID = NEWROW.BUYID;

   INSERT INTO TOTAL VALUES (1, 0);

   INSERT INTO TRADE VALUES(1, 1, 10);

Here's the stack trace:

java.lang.NullPointerException
	at org.apache.derby.iapi.types.DataTypeDescriptor.getNull(DataTypeDescriptor.java:1008)
	at org.apache.derby.iapi.types.DataTypeDescriptor.normalize(DataTypeDescriptor.java:645)
	at org.apache.derby.impl.sql.execute.NormalizeResultSet.normalizeRow(NormalizeResultSet.java:329)
	at org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(NormalizeResultSet.java:189)
	at org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(DMLWriteResultSet.java:127)
	at org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:424)
	at org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:246)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:384)
	at org.apache.derby.impl.sql.execute.GenericTriggerExecutor.executeSPS(GenericTriggerExecutor.java:159)
	at org.apache.derby.impl.sql.execute.RowTriggerExecutor.fireTrigger(RowTriggerExecutor.java:111)
	at org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(TriggerEventActivator.java:269)
	at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(InsertResultSet.java:1150)
	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:487)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:384)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:508)
	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:350)
	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:248)
	at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
	at org.apache.derby.impl.tools.ij.Main.main(Main.java:73)
	at org.apache.derby.tools.ij.main(ij.java:59)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message