Bug #51425 ExtractValue function unexpected returns NULL

Submitted: 23 Feb 2010 15:05 Modified: 25 Mar 2010 6:23
Reporter: Woocash Woo Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: XML functions Severity:S3 (Non-critical)
Version:5.1.21_beta, 5.1, 5.6.99 OS:Linux (2.6.24-26-generic / 2.6.28-gentoo-r5)
Assigned to: Assigned Account CPU Architecture:Any
Tags: ExtractValue, FUNCTION

[23 Feb 2010 15:05] Woocash Woo
Description:
When one of a node name is too long ExtractValue() returns NULL. When you reduced the node name by one character everything is going well. It does not matter whether it is one long node name or two shorter. It looks like xptah issue.

How to repeat:
mysql> select
    ->  ExtractValue(
    ->   '<a123456789z12345>
    '> <z123456789z13456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789>
    '>      <c>
    '>       c
    '>      </c>
    '> </z123456789z13456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789>
    '>    </a123456789z12345>', '//c') as c;
+---+
| c |
+---+
| NULL |
+---+
1 row in set, 1 warning (0.00 sec)

mysql> select
    ->  ExtractValue(
    ->   '<a>    <z123456789z13456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z1234>
    '>      <c>c</c>    </z123456789z13456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z1234>
    '>    </a>', '//c') as c
    -> ;
+---+
| c |
+---+
| NULL |
+---+
1 row in set, 1 warning (0.00 sec)

Suggested fix:
It would be nice if it was possible to use longer phrases in an XMLs stored in the DB.
[23 Feb 2010 17:38] MySQL Verification Team
Thank you for the bug report. Could you please print here the show warnings output after the query?. Thanks in advance.
[24 Mar 2010 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[24 Mar 2010 8:48] Woocash Woo
Little bit more info. I add show warnings response for the unexpected NULL value.

Warning | 1525 | Incorrect XML value: 'parse error at line 1 pos 137: '</c>' unexpected (END-OF-INPUT wanted)'

mysql> select ExtractValue('<a123456789z1234><z123456789z13456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789><c>c</c></z123456789z13456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789></a123456789z1234>', '//c') as c;
+------+
| c    |
+------+
| c    |
+------+
1 row in set (0.00 sec)

mysql> select ExtractValue('<a123456789z12345><z123456789z13456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789><c>c</c></z123456789z13456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789z123456789></a123456789z12345>', '//c') as c;
+------+
| c    |
+------+
| NULL |
+------+
1 row in set, 1 warning (0.00 sec)

mysql> SHOW WARNINGS;
+---------+------+-----------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                       |
+---------+------+-----------------------------------------------------------------------------------------------+
| Warning | 1525 | Incorrect XML value: 'parse error at line 1 pos 137: '</c>' unexpected (END-OF-INPUT wanted)' |
+---------+------+-----------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
[25 Mar 2010 6:22] Sveta Smirnova
Thank you for the feedback.

Verified as described.
[25 Apr 2011 19:33] Shane Bester
can't affect 5.0 since the extractvalue function doesn't exist there..

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.054 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.