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

CREATE TRIGGER with an INSERT action statement with multiple rows and a referenced column throws a StringIndexOutOfBoundsException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1.2.1, 10.2.1.6
    • Fix Version/s: 10.2.2.0, 10.3.1.4
    • Component/s: SQL
    • Labels:
      None

      Description

      These triggers succeed

      create trigger tgood after insert on x
      for each statement mode db2sql insert into x values (666), (999), (333);

      create trigger tgood after insert on x
      referencing new as n
      for each row mode db2sql insert into x values (n.x);

      create trigger tgood after insert on x
      referencing new as n
      for each row mode db2sql insert into x values (333), (999), (333)

      This one fails

      create trigger tgood after insert on x
      referencing new as n
      for each row mode db2sql insert into x values (n.x), (999), (333);

      Test cases will be added to triggerGeneral under this bug number.

      java.lang.StringIndexOutOfBoundsException: String index out of range: -3
      at java.lang.String.substring(String.java:1444)
      at org.apache.derby.impl.sql.compile.CreateTriggerNode.bindReferencesClause(CreateTriggerNode.java:421)
      at org.apache.derby.impl.sql.compile.CreateTriggerNode.bind(CreateTriggerNode.java:258)
      at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:344)
      at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:118)
      at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:713)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:560)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:507)
      at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:313)
      at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
      at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
      at org.apache.derby.impl.tools.ij.Main.go(Main.java:203)
      at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:169)
      at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:55)
      at org.apache.derby.tools.ij.main(ij.java:60)

        Attachments

        1. XMLFile1.angosso1.xml
          21 kB
          Mbiama Assogo Roger
        2. XMLFile1.angosso1.xml
          21 kB
          Mbiama Assogo Roger
        3. derby1204-trunk-stat02.txt
          0.3 kB
          Yip Ng
        4. derby1204-trunk-stat01.txt
          0.3 kB
          Yip Ng
        5. derby1204-trunk-diff02.txt
          9 kB
          Yip Ng
        6. derby1204-trunk-diff01.txt
          7 kB
          Yip Ng
        7. derby1204-10.2-stat01.txt
          0.3 kB
          Yip Ng
        8. derby1204-10.2-diff01.txt
          9 kB
          Yip Ng

          Activity

            People

            • Assignee:
              yipng Yip Ng
              Reporter:
              djd Daniel John Debrunner
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: