Bug #5013 Cant INSERT empty string in TEXT column
Submitted: 12 Aug 2004 9:50 Modified: 2 Sep 2004 12:51
Reporter: Magnus Blåudd Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:mysql-4.1 bk OS:
Assigned to: Pekka Nousiainen CPU Architecture:Any

[12 Aug 2004 9:50] Magnus Blåudd
Description:
It's not possible to INSERT empty string in TEXT columns.

INSERT INTTO t1 values("");

How to repeat:
mysql> create table foobar ( id int(10) not null auto_increment, barfoo
text not null, PRIMARY KEY (id));
Query OK, 0 rows affected (0.00 sec)
mysql> insert into foobar (barfoo) values ('');
Query OK, 1 row affected (0.00 sec)

using NDB tables this fails:

mysql> create table foobar ( id int(10) NOT NULL auto_increment, barfoo
text NOT NULL, PRIMARY KEY (id) ) TYPE=NDB;
Query OK, 0 rows affected, 1 warning (0.75 sec)

mysql> show table status;
+--------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-------------------+----------+----------------+---------+
| Name   | Engine     | Version | Row_format | Rows | Avg_row_length |
Data_length | Max_data_length | Index_length | Data_free | Auto_increment |
Create_time | Update_time | Check_time | Collation         | Checksum |
Create_options | Comment |
+--------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-------------------+----------+----------------+---------+
| foobar | ndbcluster |       9 | Dynamic    |  100 |              0 |
0 |            NULL |            0 |         0 |              0 | NULL
| NULL        | NULL       | latin1_swedish_ci |     NULL |
|         |
+--------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-------------------+----------+----------------+---------+
1 row in set (0.00 sec)

mysql> insert into foobar (barfoo) values ("");
ERROR 1296 (HY000): Got error 839 'Illegal null attribute' from ndbcluster

seems like mysql thinks the empty string is null?
Why is this and how do i get around it?
[12 Aug 2004 14:17] Martin Skold
This is a problem with handling of NULL BLOBs conflicting with NULL strings.
[20 Aug 2004 16:48] Johan Andersson
It is still a bug
[2 Sep 2004 12:51] Pekka Nousiainen
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