DB2 - Problem description
Problem IC62744 | Status: Closed |
INCORRECT RESULT WHEN USING XQUERY FN:SUBSTRING-AFTER WITH EMPTY SEQUENCE ARGUMENT | |
product: | |
DB2 FOR LUW / DB2FORLUW / 950 - DB2 | |
Problem description: | |
XQuery fn:substring-after("some arg", ()) should return "some arg" but instead returns a zero-length string. Thus the following XQuery ' XQuery fn:substring-after("a string", ()) eq "a string" ' which should return true, currently returns false. | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * DB2 LUW All Platforms * **************************************************************** * PROBLEM DESCRIPTION: * * XQuery fn:substring-after("some arg", ()) should return * * "some * * arg" but instead returns a zero-length string. * * * * * * * * Thus the following XQuery * * * * * * * * ' XQuery fn:substring-after("a string", ()) eq "a string" ' * * * * which should return true, currently returns false. * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 v95 Fixpack 5 * **************************************************************** | |
Local Fix: | |
Instead of using the substring-after function with an empty sequence passed in as the second parameter, the substring function can be used instead. An example follows: XQuery fn:substring("some arg",0,fn:string-length("some arg")+1). This will return the correct result "some arg" | |
available fix packs: | |
DB2 Version 9.5 Fix Pack 5 for Linux, UNIX, and Windows | |
Solution | |
The problem occurs because in substring-after function we are not handling the case where we pass in empty sequence as the target string with non empty source string. The fix checks for that and returns the correct results. | |
Workaround | |
not known / see Local fix | |
BUG-Tracking | |
forerunner : APAR is sysrouted TO one or more of the following: IC62828 follow-up : | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 24.08.2009 22.02.2010 22.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 |