Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL)
Description
Function JSON_QUOTE is specified in MySQL manual as
Quotes a string as a JSON value by wrapping it with double quote characters and escaping interior quote and other characters, then returning the result as a utf8mb4 string.
It works in MySQL according to this specification:
+-------------------+ |
| JSON_QUOTE('foo') | |
+-------------------+ |
| "foo" | |
+-------------------+ |
1 row in set (0.00 sec) |
|
MySQL [test]> CREATE TABLE t AS SELECT JSON_QUOTE('foo'); |
Query OK, 1 row affected (0.48 sec)
|
Records: 1 Duplicates: 0 Warnings: 0
|
|
MySQL [test]> SHOW CREATE TABLE t \G |
*************************** 1. row ***************************
|
Table: t |
Create Table: CREATE TABLE `t` ( |
`JSON_QUOTE('foo')` varchar(56) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL |
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
1 row in set (0.00 sec) |
However, in MariaDB it neither wraps the value in double quote marks, nor does it return result in utf8mb4
+-------------------+ |
| JSON_QUOTE('foo') | |
+-------------------+ |
| foo |
|
+-------------------+ |
1 row in set (0.00 sec) |
|
MariaDB [test]> CREATE TABLE t SELECT JSON_QUOTE('foo'); |
Query OK, 1 row affected (0.49 sec)
|
Records: 1 Duplicates: 0 Warnings: 0
|
|
MariaDB [test]> SHOW CREATE TABLE t \G |
*************************** 1. row ***************************
|
Table: t |
Create Table: CREATE TABLE `t` ( |
`JSON_QUOTE('foo')` varchar(36) CHARACTER SET utf8 NOT NULL |
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
1 row in set (0.00 sec) |
Attachments
Issue Links
- relates to
-
MDEV-9143 JSON_xxx functions
- Closed