A fix is available
APAR status
Closed as program error.
Error description
Incorrect NULL values may be returned from the 'count(column)' or 'count(distinct column)' function present on the inner of an OUTERJOIN when the referenced columns is defined as 'NOT NULL' and the registry variable DB2COMPOPT is set. The problematic plan will likely only be generated if the table statistics for the inner and outer tables indicate that the number of rows in the outer table is less then 20% of the number of rows in the inner table. For example the query below may get incorrect NULLs generated for the totcount function if the column AMOUNT is defined as NOT NULL and the table CONSUMER has less then 20% of the number of rows in the table ACCOUNT: select c.hsn, c.isn, a.toamount from consumer as c left outer join ( select hsn, isn, count(amount) as totamount from account group by hsn, isn) as a on c.hsn = a.hsn and c.isn = a.isn
Local fix
unset the DB2COMPOPT registry variable
Problem summary
USERS AFFECTED: ALL that use DB2COMPOPT registry variable PROBLEM DESCRIPTION Incorrect NULL values may be returned from the 'count(column)' or 'count(distinct column)' function present on the inner of an OUTERJOIN when the referenced columns is defined as 'NOT NULL' and the registry variable DB2COMPOPT is set. The problematic plan will likely only be generated if the table statistics for the inner and outer tables indicate that the number of rows in the outer table is less then 20% of the number of rows in the inner table. For example the query below may get incorrect NULLs generated for the totcount function if the column AMOUNT is defined as NOT NULL and the table CONSUMER has less then 20% of the number of rows in the table ACCOUNT: select c.hsn, c.isn, a.toamount from consumer as c left outer join ( select hsn, isn, count(amount) as totamount from account group by hsn, isn) as a on c.hsn = a.hsn and c.isn = a.isn PROBLEM SUMMARY Incorrect NULL values may be returned from the 'count(column)' or 'count(distinct column)' function present on the inner of an OUTERJOIN when the referenced columns is defined as 'NOT NULL' and the registry variable DB2COMPOPT is set. The problematic plan will likely only be generated if the table statistics for the inner and outer tables indicate that the number of rows in the outer table is less then 20% of the number of rows in the inner table. For example the query below may get incorrect NULLs generated for the totcount function if the column AMOUNT is defined as NOT NULL and the table CONSUMER has less then 20% of the number of rows in the table ACCOUNT: select c.hsn, c.isn, a.toamount from consumer as c left outer join ( select hsn, isn, count(amount) as totamount from account group by hsn, isn) as a on c.hsn = a.hsn and c.isn = a.isn
Problem conclusion
The complete fix for this problem first appears in DB2 UDB Version 8.1 FixPak 16.
Temporary fix
unset the DB2COMPOPT registry variable
Comments
APAR Information
APAR number
JR27525
Reported component name
DB2 UDB EXE WIN
Reported component ID
5724E4901
Reported release
810
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2007-09-27
Closed date
2008-02-06
Last modified date
2008-02-06
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 UDB EXE WIN
Fixed component ID
5724E4901
Applicable component levels
R810 PSN
UP
R820 PSN
UP
R910 PSN
UP
R950 PSN
UP
[{"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":"810","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]
Document Information
Modified date:
06 February 2008