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

Wrong results from query with two conjuncts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 10.3.1.4
    • 10.3.2.1, 10.4.1.3
    • SQL
    • None
    • Regression

    Description

      Tim Dudgeon, on the user list, reports that the following query returns no results in 10.3.1.4 but works correctly in 10.2. I have verified that the query returns no results in the mainline as well. If you eliminate either of the the conjuncts, then the query returns the correct results:

      SELECT MYTABLE.MY_ID
      FROM MYTABLE
      WHERE MYTABLE.MY_ID < 100 AND MYTABLE.MY_ID IN (
      2,15,19,20,21,48,49
      )

      Here is a more complete script which demonstrates the problem:

      drop table mytable;

      create table mytable ( id int primary key );

      insert into mytable ( id )
      values
      ( 0 ), ( 1 ), ( 2 ), ( 3 ), ( 4 ), ( 5 ), ( 6 ), ( 7 ), ( 8 ), ( 9 );

      insert into mytable select id + 10 from mytable;
      insert into mytable select id + 20 from mytable;
      insert into mytable select id + 40 from mytable;
      insert into mytable select id + 100 from mytable;

      select mytable.id
      from mytable
      where mytable.id < 100;

      select mytable.id
      from mytable
      where mytable.id in ( 2, 15, 19, 20, 21, 48, 49 );

      select mytable.id
      from mytable
      where mytable.id < 100
      and mytable.id in ( 2, 15, 19, 20, 21, 48, 49 );

      Attachments

        1. d3061_v2.patch
          6 kB
          A B
        2. d3061_v1.stat
          0.2 kB
          A B
        3. d3061_v1.patch
          4 kB
          A B

        Issue Links

          Activity

            People

              army A B
              rhillegas Richard N. Hillegas
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: