Bug #19228 mysql client: don't print NULL
Submitted: 20 Apr 2006 16:48 Modified: 20 Apr 2006 17:24
Reporter: Balazs Odor Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.20 OS:Linux (Debian Linux)
Assigned to: Miguel Solorzano CPU Architecture:Any

[20 Apr 2006 16:48] Balazs Odor
Description:
$ mysql
> select * from `test`;
+-------+
| value |
+-------+
| x     |
| x     |
| y     |
|       |
| y     |
+-------+
5 rows in set (0.00 sec)

Don't print NULL?

How to repeat:
> create table `test` (`value` varchar(255) default NULL);

> insert into `test` (`value`) values ('x'),('x'),('y'),(NULL),('y');

> select * from `test`;
+-------+
| value |
+-------+
| x     |
| x     |
| y     |
|       |
| y     |
+-------+
5 rows in set (0.00 sec)

> select * from `test` group by `value`;
+-------+
| value |
+-------+
|       |
| x     |
| y     |
+-------+
3 rows in set (0.00 sec)

> select isnull(`value`) from `test`;
+-----------------+
| isnull(`value`) |
+-----------------+
| 0               |
| 0               |
| 0               |
| 1               |
| 0               |
+-----------------+
5 rows in set (0.00 sec)

Why print the mysql client "" (empty string) instead of "NULL"?
[20 Apr 2006 16:55] Miguel Solorzano
Thank you for the bug report. I was unable to repeat this issue with
latest source server running on Suse linux:

mysql> create table `test` (`value` varchar(255) default NULL);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into `test` (`value`) values ('x'),('x'),('y'),(NULL),('y');
Query OK, 5 rows affected (0.00 sec)
Records: 5  Duplicates: 0  Warnings: 0

mysql> 
mysql> select * from `test`;
+-------+
| value |
+-------+
| x     | 
| x     | 
| y     | 
| NULL  | 
| y     | 
+-------+
5 rows in set (0.00 sec)

mysql> select version();
+--------------+
| version()    |
+--------------+
| 5.0.21-debug | 
+--------------+
1 row in set (0.00 sec)

mysql> 

Are you using our release package our Debian one?
[20 Apr 2006 17:06] Paul Dubois
This and a related bug have been fixed in 5.0.21. See Bug#18265.
[20 Apr 2006 17:24] Miguel Solorzano
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 bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Paul thank you for the feedback.