Fixes are available
APAR status
Closed as program error.
Error description
Db2 may return incorrect result when executing query with union view include multiple tables. For example, the query reference a view V1. SELECT C1, C2, ... FROM V1 WHERE C1 = constant AND C2 = constant ; V1 looks like following, with Q1 including multiple subqueries and UNIONs which does OUTER JOIN with other tables including T3 on column C1. CREATE VIEW V1 AS SELECT Q1.C1, Q1.C2 ... FROM ( SELECT T1.C3, T1.C4, ... T2.C1, T2.C2 ... FROM T1 LEFT OUTER JOIN T2 ON (T1.C5 = T2.T5) WHERE ... UNION ALL SELECT T1.C3, T1.C4, ... T2.C1, T2.C2 ... FROM T1 LEFT OUTER JOIN T2 ON (T1.C5 = T2.T5) WHERE ... UNION ALL SELECT T1.C3, T1.C4, ... T2.C1, T2.C2 ... FROM T1 LEFT OUTER JOIN T2 ON (T1.C5 = T2.T5) WHERE ... ) AS Q1 LEFT OUTER JOIN T3 ON (Q1.C1 = T3.C1 AND ...) ... LEFT OUTER JOIN T4 ... Because there's an equal predicate on column C1, Db2 Rewrite pushes down a local predicate 'Q1.C1 = constant' under T3, which makes 'T3.C1 = constant'. During pushing down this predicate with other join predicates under the UNION, the predicate 'T3.C1 = constant' is removed in error and causing a wrong result. The workaround is to explicitly reference T3.C1 instead of Q1.C1 as below: CREATE VIEW V1 AS SELECT T3.C1, Q1.C2 ... with this rewrite the predicate will not be removed.
Local fix
Rewrite the Query as per example in the Error Description.
Problem summary
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to Db2 11.1 Mod 4 Fixpack 5 or higher * ****************************************************************
Problem conclusion
First fixed in Db2 11.1 Mod 4 Fixpack 5
Temporary fix
Comments
APAR Information
APAR number
IT29099
Reported component name
DB2 FOR LUW
Reported component ID
DB2FORLUW
Reported release
B10
Status
CLOSED PER
PE
NoPE
HIPER
YesHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2019-05-10
Closed date
2020-01-16
Last modified date
2020-01-16
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
DB2 FOR LUW
Fixed component ID
DB2FORLUW
Applicable component levels
[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Line of Business":{"code":"LOB10","label":"Data and AI"}}]
Document Information
Modified date:
04 May 2022