suche 36x36
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

DB2 - Problem description

Problem IT18020 Status: Closed

INCORRECTLY GENERATED DERIVED PREDICATES MIGHT CAUSE INCORRECT QUERY
RESULTS DUE TO TRAILING BLANKS

product:
DB2 FOR LUW / DB2FORLUW / A50 - DB2
Problem description:
A derived predicate based on a generated column that includes 
the concatenation of a VARCHAR or VARGRAPHIC column to some 
other column or expression, could result in incorrect results if 
some of the data in the VARCHAR or VARGRAPHIC column has 
trailing blanks. 
 
For example: 
 
drop table t1; 
create table t1 ( 
c1 varchar(5) not null, 
c2 varchar(5) not null, 
c3 int, 
mc1 varchar(10) generated always as (c1||c2)); 
 
create index t1_i1 on t1 (mc1); 
 
insert into t1 (c1,c2,c3) values 
('AAA','BBB',1), 
('AAA ','BBB',2); 
 
select * from t1 where c1 = 'AAA' and c2 = 'BBB'; 
 
Query results: 
 
db2 => select * from t1 where c1 = 'AAA' and c2 = 'BBB'; 
 
C1    C2    C3          MC1 
----- ----- ----------- ---------- 
AAA   BBB             1 AAABBB 
 
  1 record(s) selected. 
 
db2 => drop index t1_i1; 
DB20000I  The SQL command completed successfully. 
db2 => select * from t1 where c1 = 'AAA' and c2 = 'BBB'; 
 
C1    C2    C3          MC1 
----- ----- ----------- ---------- 
AAA   BBB             1 AAABBB 
AAA   BBB             2 AAA BBB 
 
  2 record(s) selected. 
 
The problem is that the derived predicate is: MC1='AAABBB' which 
misses the C1 values with 'AAA' that have trailing blanks. 
 
The problem occurs for an index scan using an index the includes 
the generated column, where the derived predicate is applied as 
a start or stop key. A table scan doesn't have this issue 
because the original predicates are applied instead of the 
derived predicate. However, it is possible for the problem to 
occur for a table scan of a range partition table because 
partitions could be incorrectly eliminated based on the derived 
predicate, which could also lead to incorrectly missing rows.
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to Db2 10.5 Fix Pack 9 or higher                     * 
****************************************************************
Local Fix:
For tables that aren't range partitioned, drop the index that 
includes the generated column. For range partitioned tables, 
change the definition of the generated column to avoid 
concatenating a VARCHAR or VARGRAPHIC column that might contain 
duplicate values that differ only by the number of trailing 
blanks.
Solution
First fixed in Db2 10.5 Fix Pack 9
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
17.11.2016
29.09.2017
12.10.2017
Problem solved at the following versions (IBM BugInfos)
9.0.
Problem solved according to the fixlist(s) of the following version(s)