Bug #71694 ExtractValue not working with XPath from a table
Submitted: 12 Feb 2014 23:32 Modified: 17 Feb 2014 6:50
Reporter: Aaron Spetner (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S4 (Feature request)
Version:5.6.13, 5.6.16 OS:Any
Assigned to: CPU Architecture:Any
Tags: error, ExtractValue, XML, XPath

[12 Feb 2014 23:32] Aaron Spetner
Description:
When using ExtractValue with an XPath that comes from a table cell, the following error is returned: "Only constant XPATH queries are supported"

How to repeat:
CREATE TEMPORARY TABLE xpaths (id INT AUTO_INCREMENT PRIMARY KEY, xpath VARCHAR(255))
SELECT "/a/b" xpath;

SELECT EXTRACTVALUE("<a><b/></a>", xpath)
FROM xpaths;
[13 Feb 2014 10:38] Aaron Spetner
Update: it DOES work if the XPath is first selected into a variable. However, this is not an acceptable alternative in many situations.
[17 Feb 2014 6:49] MySQL Verification Team
Hello Aaron,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[31 Mar 2014 9:23] Georgi Kodinov
The fact that the XPATH argument to all XML functions needs to be a constant
during execution is a well-known and not a new limitation (as you're correctly pointing out).
Thus moving the bug to a feature request.
[23 Oct 2014 11:34] Daniƫl van Eeden
This could be a duplicate of Bug #34105