Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL)
-
None
Description
Notice, in the CREATE statement below the constraint belonging to the column b:
- Says that the column a is JSON
- Says nothing that the column b itself is JSON
However, the constraint actually imposes JSON format on the column b rather than column a.
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 ( |
a VARCHAR(1000), |
b VARCHAR(1000) CHECK (json_valid(a)) |
);
|
INSERT INTO t1 VALUES ('{"x": "y"}', '{"x": "y"}'); |
SELECT JSON_OBJECT('a', a), JSON_OBJECT('b', b) FROM t1; |
+-------------------------+---------------------+
|
| JSON_OBJECT('a', a) | JSON_OBJECT('b', b) |
|
+-------------------------+---------------------+
|
| {"a": "{\"x\": \"y\"}"} | {"b": {"x": "y"}} |
|
+-------------------------+---------------------+
|
Notice:
- a was treated as text
- b was treated as JSON
It's opposite to what the CHECK constraint says!
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-27360 Column level CHECK constraint is not SQL Standard compliant
- Open
-
MDEV-27018 IF and COALESCE lose "json" property
- Closed
-
MDEV-27370 UNION looses JSON property
- Open