Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL)
-
None
Description
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (j JSON); |
INSERT INTO t1 VALUES (JSON_OBJECT('b','c')); |
SELECT JSON_OBJECT('a', j) FROM (SELECT j FROM t1) d1; |
+---------------------+
|
| JSON_OBJECT('a', j) |
|
+---------------------+
|
| {"a": {"b": "c"}} |
|
+---------------------+
|
Looks good so far.
SELECT JSON_OBJECT('a', j) FROM (SELECT j FROM t1 UNION ALL SELECT j FROM t1) d1; |
+-------------------------+
|
| JSON_OBJECT('a', j) |
|
+-------------------------+
|
| {"a": "{\"b\": \"c\"}"} |
|
| {"a": "{\"b\": \"c\"}"} |
|
+-------------------------+
|
The value was erroneously escaped.
If I run similar queries in Oracle, the values does not get escaped:
CREATE TABLE t1 (j VARCHAR(10000) CONSTRAINT ensure_json CHECK (po_document IS JSON)); |
INSERT INTO t1 VALUES (JSON_OBJECT('b','c')); |
SELECT JSON_OBJECT('a' VALUE j) FROM (SELECT j FROM t1) d1; |
SELECT JSON_OBJECT('a' VALUE j) FROM (SELECT j FROM t1 UNION ALL SELECT j FROM t1) d1; |
JSON_OBJECT('A'VALUEJ)
|
{"a" : {"b" : "c"}}
|
JSON_OBJECT('A'VALUEJ)
|
{"a" : "{"b":"c"}"}
|
{"a" : "{"b":"c"}"}
|
Attachments
Issue Links
- relates to
-
MDEV-27350 Complex CHECK constraint loses JSON property
- Open
-
MDEV-27358 Table level CHECK(JSON_VALID()) constraint loses JSON property
- Open
-
MDEV-27359 Crossed JSON_VALID constraint imposes JSON property to a wrong column
- Open
-
MDEV-27361 Hybrid functions with JSON arguments do not send format metadata
- Open
-
MDEV-27018 IF and COALESCE lose "json" property
- Closed