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

NPE when inserting values to a table that has a column declared as generated by default as identity

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 10.2.1.6
    • 10.3.1.4
    • SQL
    • None
    • Sun JDK 1.4.2

    Description

      The following scenario triggers a NullPointerException in statement compilation:

      ij> create table t1 (c1 int, c2 int generated by default as identity);
      0 rows inserted/updated/deleted
      ij> insert into t1 (c2) values default, 10;
      ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

      Stacktrace from derby.log:

      Database Class Loader started - derby.database.classpath=''
      2006-08-04 06:31:17.235 GMT Thread[main,5,main] (XID = 235), (SESSIONID = 0), (DATABASE = wombat), (DRDAID = null), Cleanup action starting
      2006-08-04 06:31:17.235 GMT Thread[main,5,main] (XID = 235), (SESSIONID = 0), (DATABASE = wombat), (DRDAID = null), Failed Statement is: insert into t1 (c2) values default, 10
      java.lang.NullPointerException
      at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(ResultColumnList.java:1033)
      at org.apache.derby.impl.sql.compile.ResultColumnList.generate(ResultColumnList.java:893)
      at org.apache.derby.impl.sql.compile.RowResultSetNode.generate(RowResultSetNode.java:690)
      at org.apache.derby.impl.sql.compile.UnionNode.generate(UnionNode.java:589)
      at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(ProjectRestrictNode.java:1424)
      at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(ProjectRestrictNode.java:1286)
      at org.apache.derby.impl.sql.compile.NormalizeResultSetNode.generate(NormalizeResultSetNode.java:122)
      at org.apache.derby.impl.sql.compile.InsertNode.generate(InsertNode.java:764)
      at org.apache.derby.impl.sql.compile.StatementNode.generate(StatementNode.java:232)
      at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:477)
      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:567)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:516)
      at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:313)
      at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:478)
      at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:347)
      at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:248)
      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:69)

      sysinfo:

      ------------------ Java Information ------------------
      Java Version: 1.4.2_12
      Java Vendor: Sun Microsystems Inc.
      Java home: C:\jdk142\jre
      Java classpath: classes;.
      OS name: Windows XP
      OS architecture: x86
      OS version: 5.1
      Java user name: yip
      Java user home: C:\Documents and Settings\Administrator
      Java user dir: C:\derby\trunk
      java.specification.name: Java Platform API Specification
      java.specification.version: 1.4
      --------- Derby Information --------
      JRE - JDBC: J2SE 1.4.2 - JDBC 3.0
      [C:\derby\trunk\classes] 10.2.0.5 alpha - (1)
      ------------------------------------------------------
      ----------------- Locale Information -----------------
      Current Locale : [English/United States [en_US]]
      Found support for locale: [de_DE]
      version: 10.2.0.5 alpha - (1)
      Found support for locale: [es]
      version: 10.2.0.5 alpha - (1)
      Found support for locale: [fr]
      version: 10.2.0.5 alpha - (1)
      Found support for locale: [it]
      version: 10.2.0.5 alpha - (1)
      Found support for locale: [ja_JP]
      version: 10.2.0.5 alpha - (1)
      Found support for locale: [ko_KR]
      version: 10.2.0.5 alpha - (1)
      Found support for locale: [pt_BR]
      version: 10.2.0.5 alpha - (1)
      Found support for locale: [zh_CN]
      version: 10.2.0.5 alpha - (1)
      Found support for locale: [zh_TW]
      version: 10.2.0.5 alpha - (1)
      ------------------------------------------------------

      Attachments

        1. RSNCommentFixup_v1.diff
          2 kB
          Bryan Pendleton
        2. RSN_EnhanceRCL_Simplify_v2.diff
          6 kB
          Bryan Pendleton
        3. d1644_recursivelyCheck_v1.diff
          13 kB
          Bryan Pendleton
        4. d1644_combined_v3.diff
          21 kB
          Bryan Pendleton

        Issue Links

          Activity

            People

              bryanpendleton Bryan Pendleton
              yipng Yip Ng
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: