Spring Cleaning – Deprecation of NULL synonym \N

In the MySQL team, we’ve been discussing removing the non-standard \N synonym for NULL. For Example:

mysql> SELECT NULL is \N;
+------------+
| NULL is \N |
+------------+
|          1 |
+------------+
1 row in set (0.00 sec)

mysql> INSERT INTO tablea VALUES (3, \N);
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM tablea WHERE b IS \N;
+---+------+
| a | b    |
+---+------+
| 3 | NULL |
+---+------+
1 row in set (0.00 sec)

The use of “\N” in files loaded with LOAD DATA INFILE or created with SELECT INTO OUTFILE will be unaffected by this change and continue to be supported.

The two options we’ve laid out are:

Option #1:
– Add deprecation warnings in MySQL 5.6 and MySQL 5.7
– Remove in MySQL 5.8

Option #2:
– Add deprecation warnings in MySQL 5.6.
– Remove in MySQL 5.7

Do you rely on this behavior in your application?
Will option #2 affect you negatively?

Please feel free to leave a comment, or contact me.

Thanks!

Published by

morgo

I joined MySQL AB in 2006, left, and am now back at Oracle working on the MySQL team. I’ve also worked at Percona and InPowered.