Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.4, 11.8, 12.3, 13.1
Description
Hi,
I found that JSON_OBJECT_FILTER_KEYS can return incorrect results. This is an example:
CREATE TABLE t(doc JSON, keys_json JSON); |
INSERT INTO t VALUES |
('{"a":1,"b":2}', '["a"]'), |
('{"a":1,"b":2}', '["b"]'); |
|
|
SELECT JSON_OBJECT_FILTER_KEYS('{"a":1,"b":2}', '["a"]'); -- {"a": 1} |
SELECT JSON_OBJECT_FILTER_KEYS('{"a":1,"b":2}', '["b"]'); -- {"b": 2} |
|
|
SELECT keys_json, JSON_OBJECT_FILTER_KEYS(doc, keys_json) AS filtered |
FROM t ORDER BY keys_json; -- ["a"] NULL, ["b"] NULL |