-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expr: fix panic in json_array_append (#16929)
close #16930 mysql> drop table if exists t; Query OK, 0 rows affected, 1 warning (0.05 sec) mysql> create table t(a json, index idx((cast(json_array_append(a, '$.a', 1) as char(300))))); Query OK, 0 rows affected (0.12 sec) mysql> insert into t (a) values ('{\"a\": 1}'); Query OK, 1 row affected (0.07 sec) mysql> insert into t (a) values ('{\"b\": 1}'); Query OK, 1 row affected (0.05 sec) mysql> insert into t (a) values ('{\"a\": {\"b\": 1}}'); Query OK, 1 row affected (0.07 sec) mysql> insert into t (a) values ('{\"a\": {\"b\": [1,2,3]}}'); Query OK, 1 row affected (0.07 sec) mysql> insert into t (a) values ('[1,2,3]'); Query OK, 1 row affected (0.06 sec) mysql> insert into t (a) values ('[\"a\",\"b\"]'); Query OK, 1 row affected (0.03 sec) mysql> insert into t (a) values ('\"abc\"'); Query OK, 1 row affected (0.07 sec) mysql> insert into t (a) values ('123'); Query OK, 1 row affected (0.07 sec) mysql> insert into t (a) values ('true'); Query OK, 1 row affected (0.08 sec) mysql> insert into t (a) values ('false'); Query OK, 1 row affected (0.04 sec) mysql> insert into t (a) values (NULL); Query OK, 1 row affected (0.08 sec) mysql> mysql> select * from t ignore index(idx) where cast(json_array_append(a, '$.a', 1) as char(300)) = '{"a": [1, 1]}'; +----------+ | a | +----------+ | {"a": 1} | +----------+ 1 row in set (0.06 sec) Signed-off-by: dbsid <chenhuansheng@pingcap.com> Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e157965
commit 69f13af
Showing
1 changed file
with
166 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters