dushaoshuai / dushaoshuai.github.io

https://www.shuai.host
0 stars 0 forks source link

MySQL :: JSON Default Value #6

Open dushaoshuai opened 2 years ago

dushaoshuai commented 2 years ago

从 MySQL 8.0.13 开始

原文链接 The BLOB, TEXT, GEOMETRY, and JSON data types can be assigned a default value only if the value is written as an expression, even if the expression value is a literal.

CREATE TABLE jtable (
    jcol JSON DEFAULT (JSON_ARRAY())
);

MySQL 8.0.13 之前

原文链接 The BLOB, TEXT, GEOMETRY, and JSON data types cannot be assigned a default value.

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

参考