home clear 64x64
en blue 200x116 de orange 200x116 info letter User
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 IC83578 Status: Closed

XQUERY MIGHT RETURN INCORRECT RESULTS WHEN BOTH 'AND' AND
'OR' P REDICATES EXIST AND ALL PREDICATES CAN BE APPLIED TO XML
INDEXES

product:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problem description:
XQuery might return incorrect result when both 'AND' and 'OR' 
predicates exist, and all predicate can be applied to XML 
indexes. 
 
The following example shows a sample XQuery: 
----- a.sql ---------------------- 
select count(*) from xxxxx.xxxxxxx 
where xmlexists(' 
declare namespace xxxx = "xxxxxxxxx"; 
$data/ap:User 
  [ap:sex = "male"] 
  [ap:address = "tokyo"] 
  [ap:status = "10" or ap:status = "40"] 
' passing data as "data") 
@ 
---------------------------------- 
 
In this example, there are no explicit AND 
predicates. However, the three filters in the XQuery statement 
get combined 
to be: 
[ap:sex = "male" and ap:address = "tokyo" and  (ap:status = "10" 
or ap:status = "40")] 
The DB2 database might incorrectly 
decide that navigation is not needed and might lead to incorrect 
results when the following conditions are satisfied: 
 
- There are both AND and OR terms in the XQuery 
- All subterms are applicable to XML indexes 
- There is no extraction of data from the XML document, for 
example using XMLEXISTS 
 
The problem can affect both, SQL/XML and XQuery statements. 
SQL/XML statements that are simple and do not apply 
predicates to XML indexes are not affected by this problem.
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* All users                                                    * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 version 9.7.0.7.                              * 
****************************************************************
Local Fix:
Adding an 'or fn:false()' term to the OR predicates will prevent 
this from occuring. 
. 
Here is an example work around for the above: 
----- a.sql ---------------------- 
select count(*) from xxxxx.xxxxxxx 
where xmlexists(' 
declare namespace xxxx = "xxxxxxxxx"; 
$data/ap:User 
  [ap:sex = "male"] 
  [ap:address = "tokyo"] 
  [ap:status = "10" or ap:status = "40" or fn:false()] 
' passing data as "data") 
 
@ 
----------------------------------
available fix packs:
DB2 Version 9.7 Fix Pack 7 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 8 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 10 for Linux, UNIX, and Windows

Solution
The problem is first fixed in DB2 version 9.7.0.7.
Workaround
not known / see Local fix
BUG-Tracking
forerunner  : APAR is sysrouted TO one or more of the following: IC85608 IC85834 
follow-up : 
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
17.05.2012
18.10.2012
07.12.2012
Problem solved at the following versions (IBM BugInfos)
9.7.0.7
Problem solved according to the fixlist(s) of the following version(s)
9.7.0.7 FixList