Bug #21263 | mysql client XML output does not distinguish between NULL and string 'NULL' | ||
---|---|---|---|
Submitted: | 25 Jul 2006 3:02 | Modified: | 8 Oct 2006 6:47 |
Reporter: | joe barillari | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: XML functions | Severity: | S3 (Non-critical) |
Version: | 5.0.22 | OS: | Linux (Debian Linux) |
Assigned to: | Alexander Barkov | CPU Architecture: | Any |
Tags: | client, null, XML |
[25 Jul 2006 3:02]
joe barillari
[25 Jul 2006 6:27]
Valeriy Kravchuk
Thank you for a bug report and patch. Verified just as described. The problem is obvious in results of simple SELECT * FROM foo. NULL and 'NULL' are "visually" the same, and --xml option just presents them in the same way. While it can be OK for usual presentation of results, it is a problem for XML.
[9 Aug 2006 10:23]
Roland Bouman
The SQL Standard actually has a solution for this. There are two different methods to cope, dependant upon a global setting. 1) Omit NULL elements. 2) Mark them with a xsi:nil="true" attribute. This may be checked in: ISO 9075-14:2003, 4.8.4 "Mapping values of SQL data types to XML", p16: "As for null values, there is generally a choice of whether to represent nulls using absence or xsi:nil="true"." and, in 9.16, p 123 the full account is given of the mapping to XML values. It is not clear if the choice for representation is a choice in implementation or a choice that the user can influence runtime.
[13 Sep 2006 5:35]
Alexander Barkov
After discussion with the team, decided to dump null values as: <field name="name" xsi:nil="true" />
[13 Sep 2006 5:45]
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/11814 ChangeSet@1.2236, 2006-09-13 10:35:27+05:00, bar@mysql.com +2 -0 Bug#21263 mysql client XML output does not distinguish between NULL and string 'NULL' Fix: "mysql --xml" now print NULL values the same way that "mysqldump --xml" does: <field name="name" xsi:nil="true" /> to distinguish from empty strings: <field name="name"></field> and from string "NULL": <field name="name">NULL</field>
[29 Sep 2006 11:30]
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/12833 ChangeSet@1.2284, 2006-09-29 16:29:39+05:00, bar@mysql.com +2 -0 Bug#21263 mysql client XML output does not distinguish between NULL and string 'NULL' Fix: "mysql --xml" now print NULL values the same way that "mysqldump --xml" does: <field name="name" xsi:nil="true" /> to distinguish from empty strings: <field name="name"></field> and from string "NULL": <field name="name">NULL</field>
[3 Oct 2006 20:02]
Chad MILLER
Available in 5.0.26.
[3 Oct 2006 20:15]
Chad MILLER
Available in 5.1.12-beta.
[8 Oct 2006 6:47]
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 bug fix. More information about accessing the source trees is available at http://dev.mysql.com/doc/en/installing-source.html Noted previously undocumented --xml behaviour for mysql and mysqldump in 5.0/5.1 Client and Utility Programs chapter of Manual. Documented bugfix in 5.0.26 & 5.1.12 changelogs.