mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-25875: JSON_TABLE: extract document fragment into JSON column
Accept JSON values for the JSON fields.
This commit is contained in:
committed by
Rucha Deodhar
parent
6b6d745b9e
commit
a9f6abedde
@@ -814,6 +814,16 @@ select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted
|
||||
|
||||
select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted tinyint path '$', original text path '$')) as jt order by original;
|
||||
|
||||
select * from
|
||||
json_table('[{"color": "blue", "price": { "high": 10, "low": 5}},
|
||||
{"color": "white", "price": "pretty low"},
|
||||
{"color": "yellow", "price": 256.20},
|
||||
{"color": "red", "price": { "high": 20, "low": 8}}]',
|
||||
'$[*]' columns(color varchar(100) path '$.color',
|
||||
price json path '$.price'
|
||||
)
|
||||
) as T;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-27696 Json table columns accept redundant COLLATE syntax
|
||||
--echo #
|
||||
|
@@ -453,13 +453,11 @@ SELECT * FROM
|
||||
SELECT * FROM
|
||||
JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt;
|
||||
|
||||
# The DEFAULT value must be a string on JSON format for now.
|
||||
--error 1064
|
||||
SELECT * FROM
|
||||
JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt;
|
||||
--error 1064
|
||||
SELECT * FROM
|
||||
JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON ERROR)) jt;
|
||||
# We don't accept dates in DEFAULT
|
||||
--error 1064
|
||||
SELECT * FROM
|
||||
JSON_TABLE('{}', '$' COLUMNS (x DATE
|
||||
|
Reference in New Issue
Block a user