Bug #16237 | XML: ExtractValue() fails to return an error on a multiple match | ||
---|---|---|---|
Submitted: | 5 Jan 2006 20:39 | Modified: | 3 May 2006 12:58 |
Reporter: | Peter Gulutzan | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
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 |
[5 Jan 2006 20:39]
Peter Gulutzan
[5 Jan 2006 21:00]
MySQL Verification Team
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.1.5-alpha-debug Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> SET @xml = -> ' '> <P> '> <Ls> '> <L> '> <D>1</D> '> </L> '> <L> '> <D>2</D> '> </L> '> <L> '> <D>3</D> '> </L> '> </Ls> '> </P> '> ' -> ; Query OK, 0 rows affected (0.00 sec) mysql> SELECT EXTRACTVALUE(@xml,'/P/Ls/L/D'); +--------------------------------+ | EXTRACTVALUE(@xml,'/P/Ls/L/D') | +--------------------------------+ | 1 2 3 | +--------------------------------+ 1 row in set (0.01 sec) mysql>
[15 Jan 2006 2:44]
Jon Stephens
I discovered this independently, and I have it currently documented as expected behaviour. This seems to me to be a sensible and desirable way of dealing with multiple matches, and I don't consider throwing an error to be very useful. In fact, I think it'd be useful either to return a separate row for each match, or to permit the user to specify a delimiter (possibly optional). Otherwise please provide me a working example illustrating how users should handle multiple matches so that I can document it properly in the Manual. Thanks!
[16 Jan 2006 17:36]
Peter Gulutzan
I said that this is unexpected behaviour. The more recent comment says that this is expected behaviour. The correct way to to continue is for me to say "no it isn't", so that the reply can come back "yes it is", and so on. In a private comment, I explained why I expect an error return.
[26 Apr 2006 18:40]
Peter Gulutzan
I am now persuaded that it is okay to return a concatenation rather than an error message. If there are no other objections, changing the status to "not a bug" would be an acceptable solution.