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

Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 10.1.3.1
    • None
    • SQL
    • Normal
    • High Value Fix, Repro attached, Workaround attached

    Description

      When preparing a "INSERT INTO table SELECT FROM (...)" statement,
      Derby in some cases throw a NullPointerException or an
      AssertFailure. This happens when a '?' occurs in a VALUES statement in
      the from list. If one tries to access the table after the
      NullPointerException, this exception is thrown:

      ERROR 40XT0: An internal error was identified by RawStore module.

      Example:

      ij> create table t (text varchar(20), len int);
      0 rows inserted/updated/deleted
      ij> prepare p as 'insert into t select x, length from (values) as v';
      ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
      ij> select * from t;
      ERROR 40XT0: An internal error was identified by RawStore module.

      Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
      there is enough information in the query to determine the type of the
      parameter even without the cast.

      Attachments

        1. repro1528_npe.java
          1 kB
          Knut Anders Hatlen
        2. repro1528_assert.java
          1 kB
          Knut Anders Hatlen

        Activity

          People

            Unassigned Unassigned
            knutanders Knut Anders Hatlen
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: