Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
None
-
None
-
Not for Release Notes
Description
(for all server version)
For a nullable column with no DEFAULT clause (or an explicit DEFAULT NULL), information_schema.columns COLUMN_DEFAULT is returned as the 4‑byte string "NULL", not NULL.
This diverges from MySQL, which return NULL here, and breaks tools that use COLUMN_DEFAULT IS NULL to detect "no default."
Repro:
CREATE TABLE t (a INT); -- nullable, no default |
SELECT column_default, |
column_default IS NULL AS is_sql_null, |
HEX(column_default) AS bytes |
FROM information_schema.columns |
WHERE table_schema = DATABASE() AND table_name = 't' AND column_name = 'a'; |
|
=>
+----------------+-------------+----------+
|
| column_default | is_sql_null | bytes |
|
+----------------+-------------+----------+
|
| NULL | 0 | 4E554C4C |
|
+----------------+-------------+----------+
|
|