IBM Support

IZ62236: Outer join operation may return incorrect results with a predicate with a subquery returning not more than one row

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The problem occurs if all and each of the following conditions
    are met:
    1. There is an OUTER JOIN operation.
    2. There is a WHERE-clause applied to the OUTER JOIN.
    3. The WHERE-clause contains a scalar subquery (subquery that is
    required to return not more than one row).
    4. The subquery has an index or operation which will return
    either one or zero row.
    5. The subquery is part of an OR operator.
    6. The actual data results in the subquery returning zero row.
    7. The other part of the OR operator returns not more than one
    row.
    
    This problem was first introduced in the following DB2 releases:
    
    Version 9.1 Fix Pack 7
    Version 9.5 Fix Pack 4
    Version 9.7 GA
    
    Example:
    create table T2(c1 int not null primary key, c2 int)
    create table T3(c1 int not null primary key)
    insert into T2 values(1,1)
    insert into T3 values(9)
    
    select t2.c1 from t2 left join t3 on t2.c2=t3.c1 where t2.c1 = 1
    or t2.c1 = (select c1 from t2 where c1=11)
    
    The correct result should return one row.
    
    C1
    -----------
              1
    
      1 record(s) selected.
    
    The SQL statement meets all the conditions described above. It
    has an OUTER JOIN (1) and a WHERE-clause (2). The WHERE-clause
    contains a scalar subquery (3) which is a part of an OR operator
    (5). The presence of the PRIMARY key (or a unique index) on
    column T2.C1 ensures that the subquery will either return one
    row or zero row (4).
    
    In addition, the actual data set results in the subquery does
    not return any row (6) and the other part of the OR operator,
    t2.c1=1, returns one row (7).
    

Local fix

  • Upgrade the DB2 Version to one of the following DB2 releases:
    Version 9.1 Fix Pack 9
    Version 9.5 Fix Pack 5
    Version 9.7 Fix Pack 1
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * SQL statement returned incorrect results.                    *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See the APAR description.                                    *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrde to DB2 UDB version 9.1 fixpack 9.                     *
    ****************************************************************
    

Problem conclusion

  • Problem was first fixed in DB2 UDB Version 9.1 FixPack 9.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ62236

  • Reported component name

    DB2 EDE AIX

  • Reported component ID

    5724N7600

  • Reported release

    910

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    YesHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2009-09-29

  • Closed date

    2010-04-14

  • Last modified date

    2010-04-14

  • APAR is sysrouted FROM one or more of the following:

    IC63414

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    DB2 EDE AIX

  • Fixed component ID

    5724N7600

Applicable component levels

  • R910 PSN UP

       IZ62236

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"910","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
14 April 2010