Skip to content

Commit e1f0f0d

Browse files
committed
Revert "MDEV-11439 No data type JSON, but CAST(something AS JSON) pretends to work"
This reverts commit 1f372cf. Wasn't supposed to be pushed just yet.
1 parent 1f372cf commit e1f0f0d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

mysql-test/r/func_json.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,15 @@ json_object("a", json_object("b", "abcd"))
402402
select json_object("a", '{"b": "abcd"}');
403403
json_object("a", '{"b": "abcd"}')
404404
{"a": "{\"b\": \"abcd\"}"}
405+
select json_object("a", cast('{"b": "abcd"}' as json));
406+
json_object("a", cast('{"b": "abcd"}' as json))
407+
{"a": {"b": "abcd"}}
408+
select cast(NULL AS JSON);
409+
cast(NULL AS JSON)
410+
NULL
411+
select json_depth(cast(NULL as JSON));
412+
json_depth(cast(NULL as JSON))
413+
NULL
405414
select json_depth('[[], {}]');
406415
json_depth('[[], {}]')
407416
2

mysql-test/t/func_json.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ select json_unquote('abc');
161161

162162
select json_object("a", json_object("b", "abcd"));
163163
select json_object("a", '{"b": "abcd"}');
164-
#select json_object("a", cast('{"b": "abcd"}' as json));
164+
select json_object("a", cast('{"b": "abcd"}' as json));
165165

166-
#select cast(NULL AS JSON);
167-
#select json_depth(cast(NULL as JSON));
166+
select cast(NULL AS JSON);
167+
select json_depth(cast(NULL as JSON));
168168
select json_depth('[[], {}]');
169169
select json_depth('[[[1,2,3],"s"], {}, []]');
170170
select json_depth('[10, {"a": 20}]');

sql/sql_yacc.yy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10714,6 +10714,7 @@ cast_type:
1071410714
}
1071510715
| cast_type_numeric { $$= $1; Lex->charset= NULL; }
1071610716
| cast_type_temporal { $$= $1; Lex->charset= NULL; }
10717+
| JSON_SYM { $$.set(ITEM_CAST_JSON); }
1071710718
;
1071810719

1071910720
cast_type_numeric:

0 commit comments

Comments
 (0)