Derby
  1. Derby
  2. DERBY-4372

Wrong result for simple join when index is created

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 10.1.3.3, 10.2.2.1, 10.5.1.1
    • Fix Version/s: 10.5.3.1, 10.6.1.0
    • Component/s: SQL
    • Labels:
      None
    • Urgency:
      Urgent
    • Issue & fix info:
      Repro attached
    • Bug behavior facts:
      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

      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

        Bernt M. Johnsen created issue -
        Knut Anders Hatlen made changes -
        Field Original Value New Value
        Issue & fix info [Repro attached]
        Knut Anders Hatlen made changes -
        Assignee Knut Anders Hatlen [ knutanders ]
        Knut Anders Hatlen made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Knut Anders Hatlen made changes -
        Attachment derby-4372-1a.diff [ 12419879 ]
        Attachment derby-4372-1a.stat [ 12419880 ]
        Knut Anders Hatlen made changes -
        Attachment experiment.diff [ 12419901 ]
        Knut Anders Hatlen made changes -
        Fix Version/s 10.6.0.0 [ 12313727 ]
        Knut Anders Hatlen made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 10.5.3.1 [ 12314182 ]
        Resolution Fixed [ 1 ]
        Mamta A. Satoor made changes -
        Affects Version/s 10.1.3.3 [ 12313478 ]
        Mamta A. Satoor made changes -
        Affects Version/s 10.2.2.1 [ 12312251 ]
        Kathey Marsden made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Gavin made changes -
        Workflow jira [ 12476315 ] Default workflow, editable Closed status [ 12800090 ]

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Bernt M. Johnsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development