简体   繁体   English

函数json_object不存在

[英]Function json_object does not exist

i try to build an function which returns a json. 我尝试建立一个返回json的函数。

I updated my mysql Workbench to 8.0.14 and tried the following code: 我将mysql工作台更新为8.0.14,并尝试了以下代码:

 SELECT JSON_OBJECT(
  'name_field', name_field,
  'address_field', address_field,
  'contact_age', contact_age
)
FROM contact;

But the following error appears: 但是出现以下错误:

Error Code: 1305. FUNCTION datalog.json_object does not exist 错误代码:1305。FUNCTIONdatalog.json_object不存在

I thought that json_object is a standard mysql function, ins't it? 我以为json_object是标准的mysql函数,不是吗?

See here: JSON Object 参见此处: JSON对象

You're using MariaDB, not MySQL, and your version (MariaDB 10.1) is roughly comparable to MySQL 5.7, with some important differences. 您使用的是MariaDB,而不是MySQL,并且您的版本(MariaDB 10.1)与MySQL 5.7大致相当,但有一些重要区别。 Your Workbench version is irrelevant - it's the server version that matters. 您的Workbench版本无关紧要-重要的是服务器版本。

https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/ https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/

MariaDB 10.1 and above does not support MySQL 5.7's packed JSON objects. MariaDB 10.1及更高版本不支持MySQL 5.7的打包JSON对象。 MariaDB follows the SQL standard and stores the JSON as a normal TEXT/BLOB. MariaDB遵循SQL标准,并将JSON存储为普通的TEXT / BLOB。 If you want to replicate JSON columns from MySQL to MariaDB, you should store JSON objects in MySQL in a TEXT column or use statement based replication. 如果要将JSON列从MySQL复制到MariaDB,则应将JSON对象存储在MySQL中的TEXT列中,或使用基于语句的复制。 If you are using JSON columns and want to upgrade to MariaDB, you can either convert the JSON columns to TEXT or use mysqldump to copy these tables to MariaDB. 如果您正在使用JSON列并想要升级到MariaDB,则可以将JSON列转换为TEXT,也可以使用mysqldump将这些表复制到MariaDB。 In MySQL, JSON is compared according to json values. 在MySQL中,根据json值比较JSON。 In MariaDB JSON strings are normal strings and compared as strings. 在MariaDB中,JSON字符串是普通字符串,并作为字符串进行比较。

MariaDB 10.2.3 adds JSON_OBJECT support. MariaDB 10.2.3添加了JSON_OBJECT支持。 https://mariadb.com/kb/en/library/json_object/ https://mariadb.com/kb/en/library/json_object/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM