[MDEV-9367] ExtractValue function doesn't work in stored procedure first few times Created: 2016-01-05 Updated: 2016-03-29 Resolved: 2016-03-29 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | XML Functions |
| Affects Version/s: | 10.0.22, 10.1.9, 10.0, 10.1 |
| Fix Version/s: | 5.5.48, 10.0.24, 10.1.13 |
| Type: | Bug | Priority: | Major |
| Reporter: | Estructure | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
I have reproduced the bug with 10.0.22 from official repository on debian Jessie ( 10.0.22-0+deb8u1) and 10.1.9 on Windows |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Sprint: | 10.2.0-9 | ||||||||
| Description |
|
I have a stored procedure wich process an XML field to get some data. The first few times the procedure is executed it returns NULL or empty string, then it works fine. From HeidiSql, for example, it usually fails two times and then works right, and from ToadSql it fails about four times and then works everytime (the number of failures seems consistent, but could be luck). The line that seems to be failing is a call to ExtractValue (here with some context): DECLARE counter INT UNSIGNED DEFAULT 1; |
| Comments |
| Comment by Elena Stepanova [ 2016-01-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Please provide a complete example allowing to reproduce the problem.
Alternatively, you could dissect your code yourself, and extract the actual consequent calls to ExtractValue with already expanded values of xml. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Estructure [ 2016-01-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I've attached a file to setup the test environment (creates database, table and stored proc and populates table). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Estructure [ 2016-01-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The two first calls to sp_xml_test return NULL, the third one returns the expected result. I have replaced every character I could with 'a' to avoid encoding problems. The fields used in the XPath are the exception to this, with names like abcd... The problem goes away if I downgrade the mariadb version to the older debian supported one (10.0.16-1). Execution results:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2016-01-12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks, with the attached data I can reproduce the problem.
Apparently the problem was introduced by this merge:
It might well be related to I am assigning this to sanja, but sanja, cvicentiu, please make sure you don't duplicate each other's work, it's possible that one fix will fix both issues. Please discuss and feel free to reassign to each other if necessary. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-03-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For me in works as expected: aaaaa></aaaaaaaaaaaaaa></abcd>'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2016-03-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The problem was fixed in 5.5.48 (and the fix further merged up to 10.0.24, 10.1.13) by the merge from MySQL 5.5, particularly this change:
|