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

ArrayIndexOutOfBoundsException in RIGHT JOIN with COALESCE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 10.0.2.1, 10.1.3.1, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.1.0
    • None
    • SQL
    • None
    • Repro attached

    Description

      Dag H. Wanvik identified this problematic query in DERBY-4342:

      ij> create table t(x int, y int);
      0 rows inserted/updated/deleted
      ij> insert into t values (1,2);
      1 row inserted/updated/deleted
      ij> select * from t t1 right join t t2 on t1.x=t2.x where coalesce(t1.x,t1.y) = 1;
      ERROR 38000: The exception 'java.lang.ArrayIndexOutOfBoundsException: -1' was thrown while evaluating an expression.
      ERROR XJ001: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException'.

      With a debug build, an assert failure is raised instead:

      ij> select * from t t1 right join t t2 on t1.x=t2.x where coalesce(t1.x,t1.y) = 1;
      ERROR XJ001: Java exception: 'ASSERT FAILED sourceResultSetNumber expected to be >= 0 for T1.X: org.apache.derby.shared.common.sanity.AssertFailure'.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: