Bug #94316 JSON type can have default value of null in table creation
Submitted: 13 Feb 18:55 Modified: 19 Feb 15:58
Reporter: Randen Kelly Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:5.7+ OS:Any
Assigned to: CPU Architecture:Any

[13 Feb 18:55] Randen Kelly
Description:
Documentation says "A JSON column cannot have a default value.". Yet this is possible when creating a table.

Although, Modifying a column does not allow you to do this.

How to repeat:
Create a table with a JSON type column with DEFAULT NULL.

CREATE TABLE `test` (
`foo` json DEFAULT NULL
);

Suggested fix:
Restrict this in table creation just as it is done in ALTER statments
[13 Feb 20:19] Miguel Solorzano
Thank you for the bug report.
[19 Feb 15:58] Paul Dubois
Posted by developer:
 
Corrections made:

https://dev.mysql.com/doc/refman/5.7/en/json.html

A JSON column cannot have a non-NULL default value.

https://dev.mysql.com/doc/refman/8.0/en/json.html

Prior to MySQL 8.0.13, a JSON column cannot have a non-NULL default value.