DB2 - Problem description
Problem IC61541 | Status: Closed |
XQUERY RETURNS INCORRECT RESULTS. FOR LEAF ELEMENTS ONLY THE ELEMENT TAG IS RETURNED AND THE TEXT WITHIN IS SKIPPED | |
product: | |
DB2 FOR LUW / DB2FORLUW / 950 - DB2 | |
Problem description: | |
The problem starts from V95 GA and is also in V97 GA. This is a stale pointer XML serialization problem which leads to incorrect xml query results. The problem happens when the in memory page which holds the document section being processed is erroneously released causing a stale pointer during XML serialization. When this happens simple queries such as the following will return incorrect results. xquery for $i in db2-fn:xmlcolumn(<column name>)//<element name>return $i; The incorrect results are made up of only the Element tag being returned, and the Text within the element being skipped. This happens in most cases for leaf elements. For example if we have this sample doc: <?xml version="1.0" standalone="yes"?> <someroot xmlns="http://www.w3.org/"> <a> <b> <c> <d> <e> <f> <g> <h>Elem Text Child</h> </g> <g/> <g/> ................... ..... </someroot> xquery let $i := db2-fn:sqlquery('select doc from stlptr')//text()/.. return $i; Would return the wrong result: <h xmlns="http://www.w3.org/" /> Instead of the correct result: <h xmlns="http://www.w3.org/">Elem Text Child</h> | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * DB2 LUW All Platforms * **************************************************************** * PROBLEM DESCRIPTION: * * This is a stale pointer problem in XML serialization which * * leads to * * incorrect xml query results. * * * * The problem happens when the in memory page which holds the * * document section being processed is erroneously * * released causing a stale pointer during XML serialization. * * When * * this happens simple queries such as the following will * * return * * incorrect results. * * * * xquery for $i in db2-fn:xmlcolumn(<column name>)//<element * * name>return $i; * * * * The incorrect results are made up of only the Element tag * * being * * returned, and the Text within the element being skipped. * * This * * happens in most cases for leaf elements. * * * * For example if we have this sample doc: * * * * <?xml version="1.0" standalone="yes"?> * * <someroot xmlns="http://www.w3.org/"> * * <a> * * <b> * * <c> * * <d> * * <e> * * <f> * * <g> * * <h>Elem Text Child</h> * * </g> * * <g/> * * <g/> * * ................... * * ..... * * </someroot> * * * * xquery let $i := db2-fn:sqlquery('select doc from * * stlptr')//text()/.. return $i; * * * * Would return the wrong result: * * * * <h xmlns="http://www.w3.org/" /> * * * * Instead of the correct result: * * * * <h xmlns="http://www.w3.org/">Elem Text Child</h> * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 v95 Fixpack 5 * **************************************************************** | |
Local Fix: | |
available fix packs: | |
DB2 Version 9.5 Fix Pack 5 for Linux, UNIX, and Windows | |
Solution | |
The fix makes sure we serialize the in scope namespaces for the element with the correct flags which prevents it from going stale. With the fix the customer should see the missing element text as part of the element node. | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 17.06.2009 19.02.2010 19.02.2010 |
Problem solved at the following versions (IBM BugInfos) | |
9.5.FP5 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.5.0.5 |