Bug #16315 XML: extractvalue() handles self badly
Submitted: 9 Jan 2006 23:22 Modified: 2 Mar 2006 10:08
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:22] Peter Gulutzan
Description:
With extractvalue() there seems to be some overlapping
of self() with descendant-or-self(). If the descendants
are B+C, and self is B, then I can't see how
descendants-or-self is A+B+C.

How to repeat:
mysql> select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*');
+-------------------------------------------------------------+
| extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*') |
+-------------------------------------------------------------+
| B C                                                         |
+-------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*');
+-------------------------------------------------------+
| extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*') |
+-------------------------------------------------------+
| B                                                     |
+-------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*');
+---------------------------------------------------------------------+
| extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*') |
+---------------------------------------------------------------------+
| A B C                                                               |
+---------------------------------------------------------------------+
1 row in set (0.00 sec)
[18 Jan 2006 10:47] Alexander Barkov
Peter, do I understand correctly that "self" doesn't work well,
while "descendand" and "descendand-or-self" work fine? Right?
[1 Mar 2006 9:22] 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/3301
[2 Mar 2006 7:35] Alexander Barkov
Pushed into 5.1.8.
[2 Mar 2006 10:08] 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 bugfix in 5.1.8 changelog. Closed.