Bug #73492 NULL gets 'NULL' after reimport recordset
Submitted: 7 Aug 2014 7:29 Modified: 23 Jan 2017 17:21
Reporter: Thorsten Scheckenbach Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:6.1, 6.1.7 OS:MacOS (10.9.4)
Assigned to: CPU Architecture:Any
Tags: export, recordset

[7 Aug 2014 7:29] Thorsten Scheckenbach
Description:
If a recordset gets exported and re imported all NULL values are transformed to string 'NULL'

How to repeat:
1. Insert some sample data to table (with some NULL values in fields)
2. Click "export recordset to an external file"
3. Click "import recordset from an external file"

Suggested fix:
NULL must be NULL not 'NULL' after import
[7 Aug 2014 8:24] MySQL Verification Team
Hello Thorsten Scheckenbach,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[7 Aug 2014 8:26] MySQL Verification Team
// How to repeat ( Win7 + WB 6.1.7)

mysql>
mysql> show create table test.t100\G
*************************** 1. row ***************************
       Table: t100
Create Table: CREATE TABLE `t100` (
  `id` int(11) NOT NULL,
  `t100col` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql> INSERT INTO test.t100(id) values(1);
Query OK, 1 row affected (0.03 sec)

mysql> SELECT * FROM test.t100;
+----+---------+
| id | t100col |
+----+---------+
|  1 | NULL    |
+----+---------+
1 row in set (0.00 sec)

mysql> SELECT * FROM test.t100 where t100col is null;
+----+---------+
| id | t100col |
+----+---------+
|  1 | NULL    |
+----+---------+
1 row in set (0.00 sec)

// Export table rows from WB/SQL Editor
// Export to test.csv ( ensure you removed columns headers before importing file)

mysql> truncate test.t100;
Query OK, 0 rows affected (0.38 sec)

// Import from WB/SQL Editor
// Import the dump file and notice that "apply" dailog shows SQL as (INSERT INTO `test`.`t100` (`id`, `t100col`) VALUES ('1', 'NULL');
// Confirm whether the column is NULL or string 'NULL'

mysql> SELECT * FROM test.t100;
+----+---------+
| id | t100col |
+----+---------+
|  1 | NULL    |
+----+---------+
1 row in set (0.00 sec)

mysql> SELECT * FROM test.t100 where t100col is null;
Empty set (0.00 sec)
[23 Jan 2017 17:21] Christine Cole
Posted by developer:
 
Bug was not reproduced. No changelog entry needed.