Derby
  1. Derby
  2. DERBY-4544

Referencing streaming CLOBs in (some) generated column clauses fails

    Details

    • Urgency:
      Low
    • Issue & fix info:
      Patch Available, Repro attached
    • Bug behavior facts:
      Data corruption

      Description

      Referencing a CLOB represented as a stream in generated columns can lead to data corruption or that the query fails.

      For instance, with 10.5:
      create table t (id int, myclob clob, clen generated always as (length(myclob)));

      1. Insert CLOB using the streaming APIs (setCharacterStream).
        The exception 'java.lang.ClassCastException: org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to org.apache.derby.iapi.types.Resetable'

      On trunk the same query results in data corruption, and this isn't detected before the value is read back from store.

      Workaround:
      Don't use the streaming APIs when using CLOBs in generated columns. This increases the memory footprint, and may not feasible for large CLOBs.

      FYI, BLOB deals with this by materializing the value, which effectively equals to using the workaround mentioned above.

      1. Test_4544.java
        3 kB
        Rick Hillegas
      2. Test_4544.java
        4 kB
        Rick Hillegas
      3. Test_4544.java
        8 kB
        Rick Hillegas
      4. derby-4544-01-ac-shortCircuitLengthOptimization.diff
        9 kB
        Rick Hillegas
      5. derby-4544-01-ab-shortCircuitLengthOptimization.diff
        5 kB
        Rick Hillegas

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Rick Hillegas
              Reporter:
              Kristian Waagan
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development