Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3718

NPE when firing a trigger

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.4.1.3, 10.5.1.1
    • Fix Version/s: 10.4.2.0, 10.5.1.1
    • Component/s: SQL
    • Labels:
      None
    • Bug behavior facts:
      Regression

      Description

      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)

        Attachments

          Activity

            People

            • Assignee:
              mamtas Mamta A. Satoor
              Reporter:
              rhillegas Richard N. Hillegas

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment