Bug #20501 | CSV Engine Null Values | ||
---|---|---|---|
Submitted: | 16 Jun 2006 12:31 | Modified: | 25 Jan 2007 11:09 |
Reporter: | Claudio Andenmatten | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.0.21/5.1bk | OS: | Solaris (Solaris 8 (64bit)) |
Assigned to: | Antony Curtis | CPU Architecture: | Any |
[16 Jun 2006 12:31]
Claudio Andenmatten
[16 Jun 2006 19:08]
MySQL Verification Team
Thank you for the bug report. Verified as described on Suse 10 32-bit.
[16 Jun 2006 22:16]
Peter Laursen
I do not think that EMPTY STRING "" should be considered NULL! An empty string is not a NULL value! NULL values should be stored as /N or NULL (un-quoted)!
[16 Jun 2006 22:17]
Peter Laursen
Of course I meant \N ... not /N
[16 Jun 2006 22:44]
MySQL Verification Team
Yes should be NULL instead of 0 when the column is number type and not "" when string one.
[19 Jun 2006 6:38]
Claudio Andenmatten
I was not aware of the fact that I am able to discuss core features of the CSV engine here. Therefore I was not very exact. I apologize. First I agree with Peter, NULL is not equal to an empty string. So this rises to questions: Q1: how to store a NULL in CSV Q2: how to treat (cast) empty strings in SQL queries IMHO both questions are not trivial. A1: Store \N would be a solution. But nobody else is doing it this way (eg. Excel), so the portability is weakened. And as I understand portability is a goal of the CSV engine. A2: Is MySql (like other RDBMS) casting empty strings to NULL or not? As I can see it is not. The MyISAM engine casts empty numbers always to 0 (zero). CSV engine as well. This is why I filed the bug. This is strange behaviour, but acceptable. Empty Strings are casted to NULL by MyISAM engine, BUT in retrieval it can still be distinguished between NULL and empty string! So it kind of stores a special NULL for empty strings. In CSV engine it stores "" for empty strings and therefore it is not possible to distinguish empty strings and NULLs anymore. NULL values are lost. So long speech short, IMHO these are not bugs, but slightly inconsistent behaviour. I am looking forward to your comment. Claudio
[25 Sep 2006 17:31]
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/12487 ChangeSet@1.2324, 2006-09-25 10:29:42-07:00, acurtis@xiphis.org +5 -0 Bug#20501 "NULL not supported in CSV tables" Add support for NULL values
[27 Sep 2006 17:34]
Calvin Sun
Brian comments: "that is a backwards incompatible change".
[25 Jan 2007 11:12]
Antony Curtis
Patch pending for 122 days.