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

Wrong result for simple join when index is created

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 10.1.3.3, 10.2.2.1, 10.5.1.1
    • 10.5.3.1, 10.6.1.0
    • SQL
    • None
    • Urgent
    • Repro attached
    • Wrong query result

    Description

      In the example below, the first SELECT has correct result. After the index is created, the second SELECT gives wrong result.

      ij> CREATE TABLE t1 (i1 INT, j1 INT);
      0 rows inserted/updated/deleted
      ij> CREATE TABLE t2 (i2 INT, j2 INT);
      0 rows inserted/updated/deleted
      ij> INSERT INTO t1 VALUES (8, 8),(NULL, 8);
      2 rows inserted/updated/deleted
      ij> INSERT INTO t2 VALUES (8, 8);
      1 row inserted/updated/deleted
      ij> SELECT * FROM t1 INNER JOIN t2 ON (t2.j2 = t1.i1) OR (t2.j2 = t1.j1);
      I1 |J1 |I2 |J2
      -----------------------------------------------
      8 |8 |8 |8
      NULL |8 |8 |8

      2 rows selected
      ij> CREATE INDEX ix2 ON t2(j2);
      0 rows inserted/updated/deleted
      ij> SELECT * FROM t1 INNER JOIN t2 ON (t2.j2 = t1.i1) OR (t2.j2 = t1.j1);
      I1 |J1 |I2 |J2
      -----------------------------------------------
      8 |8 |8 |8

      1 row selected

      Attachments

        1. experiment.diff
          2 kB
          Knut Anders Hatlen
        2. derby-4372-1a.stat
          0.2 kB
          Knut Anders Hatlen
        3. derby-4372-1a.diff
          5 kB
          Knut Anders Hatlen

        Activity

          People

            knutanders Knut Anders Hatlen
            bernt Bernt Johnsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: