You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Values
A JSON value MUST be an object, array, number, or string, or one of
the following three literal names:
false null true
The literal names MUST be lowercase. No other literal names are
allowed.
value = false / null / true / object / array / number / string
所以 MySQL 的 json 字段合法值要么是字符串 "null",要么是空值 null/NULL,而字符串 "NULL" 不合法
environment
Issue Description
canal 把 json 类型字段的 "null" 值转换成了 "NULL" 值,再往 mysql 插入这个字段会报错,json "NULL" 无法解析
MySQL 遵循 RFC 7159 规范使用 JSON
规范里面表明 JSON 的几个 literal 类型必须是小写:
所以 MySQL 的 json 字段合法值要么是字符串 "null",要么是空值 null/NULL,而字符串 "NULL" 不合法
canal 代码在:https://github.com/alibaba/canal/blob/master/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/JsonConversion.java
不知道这里的考虑是怎样的,能否改回 "null" ?
Steps to reproduce
create table t (data json);
insert into t values ('null');
insert into t values ('NULL');
insert into t values (NULL);
If there is an exception, please attach the exception trace:
The text was updated successfully, but these errors were encountered: