【发布时间】:2020-04-14 18:12:48
【问题描述】:
我必须做一个类似这样的查询:
SomeModel::whereRaw("JSON_CONTAINS(column, '', '$.a')")->get();
column contains JSON *{"a":null}*;
使用 mysql 5.7 版一切正常,我得到空集合,但在 digitalocean 上的数据库上,即 mysql v8.0.17 我得到这个错误:
Illuminate/Database/QueryException with message 'SQLSTATE[22032]: : 3141 Invalid JSON text in argument 1 to function json_contains: "The document is empty."在位置 0。(SQL: select * from 'table' where JSON_CONTAINS(column, '', '$.a'))'
我被困了好几天了,请帮忙! :)
【问题讨论】: