Bug #16318 XML: extractvalue() incorrectly returns last() = 1
Submitted: 9 Jan 2006 23:26 Modified: 13 Mar 2006 10:24
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: XML functions Severity:S3 (Non-critical)
Version:5.1.5-alpha-debug OS:Linux (SUSE 10.0)
Assigned to: Alexander Barkov CPU Architecture:Any

[9 Jan 2006 23:26] Peter Gulutzan
Description:
With extractvalue(), the last() function returns 1
even when there is more than one node.

How to repeat:
mysql> select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=1]');
+-------------------------------------------------------------+
| extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=1]') |
+-------------------------------------------------------------+
| B1 B2                                                       |
+-------------------------------------------------------------+
1 row in set (0.00 sec)
[9 Jan 2006 23:47] Miguel Solorzano
mysql> select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=1]');
+-------------------------------------------------------------+
| extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=1]') |
+-------------------------------------------------------------+
| B1 B2                                                       |
+-------------------------------------------------------------+
1 row in set (0.01 sec)
[3 Mar 2006 14:41] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3433
[9 Mar 2006 9:53] Alexander Barkov
Fixed in 5.1.8
[13 Mar 2006 10:24] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented fix in 5.1.8 changelog; closed.