summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2021-04-06 12:18:02 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2021-04-21 10:21:45 +0400
commit5a8abbb77d84b2ea3d4990d05767f675d10c5c89 (patch)
tree2e762bdd0768ee13d6314ddd58d9997d69f501b8
parent1be9c51beb836b0cd54e91c5b9dc8866137571c4 (diff)
downloadmariadb-git-5a8abbb77d84b2ea3d4990d05767f675d10c5c89.tar.gz
MDEV-17399 JSON_TABLE.
tests updated.
-rw-r--r--mysql-test/main/query_cache.result4
-rw-r--r--mysql-test/main/query_cache.test2
-rw-r--r--mysql-test/suite/json/r/json_table.result18
-rw-r--r--mysql-test/suite/json/t/json_table.test11
4 files changed, 34 insertions, 1 deletions
diff --git a/mysql-test/main/query_cache.result b/mysql-test/main/query_cache.result
index 020c7472694..33e41a760f2 100644
--- a/mysql-test/main/query_cache.result
+++ b/mysql-test/main/query_cache.result
@@ -2210,7 +2210,9 @@ drop table t1;
#
# MDEV-24858 SIGABRT in DbugExit from my_malloc in Query_cache::init_cache Regression
#
+SET @qc= @@query_cache_size;
set global Query_cache_size=18446744073709547520;
+SET GLOBAL query_cache_size= @qc;
#
# MDEV-22301 JSON_TABLE: Queries are not inserted into query cache.
#
@@ -2225,7 +2227,7 @@ a f
{"a":"foo"} foo
SHOW STATUS LIKE 'Qcache_inserts';
Variable_name Value
-Qcache_inserts 0
+Qcache_inserts 1
drop table t1;
#
# MDEV-25228 JSON_TABLE: Server crashes in Query_cache::unlink_table.
diff --git a/mysql-test/main/query_cache.test b/mysql-test/main/query_cache.test
index 66785b42c36..939bf738fce 100644
--- a/mysql-test/main/query_cache.test
+++ b/mysql-test/main/query_cache.test
@@ -1804,7 +1804,9 @@ drop table t1;
--echo # MDEV-24858 SIGABRT in DbugExit from my_malloc in Query_cache::init_cache Regression
--echo #
--disable_warnings
+SET @qc= @@query_cache_size;
set global Query_cache_size=18446744073709547520;
+SET GLOBAL query_cache_size= @qc;
--enable_warnings
--echo #
diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result
index e1c87853379..de93d55087d 100644
--- a/mysql-test/suite/json/r/json_table.result
+++ b/mysql-test/suite/json/r/json_table.result
@@ -668,6 +668,24 @@ RIGHT JOIN JSON_TABLE('[]', '$' COLUMNS(o3 FOR ORDINALITY)) AS jt3
ON(1)
WHERE 0;
ERROR 42S22: Unknown column 'jt1.a' in 'JSON_TABLE argument'
+create table t1 (item_name varchar(32), item_props varchar(1024));
+insert into t1 values ('Jeans', '{"color": ["green", "brown"], "price": 50}');
+insert into t1 values ('Shirt', '{"color": ["blue", "white"], "price": 20}');
+insert into t1 values ('Jeans', '{"color": ["black"], "price": 60}');
+insert into t1 values ('Jeans', '{"color": ["gray"], "price": 60}');
+insert into t1 values ('Laptop', '{"color": ["black"], "price": 1000}');
+insert into t1 values ('Shirt', '{"color": ["black"], "price": 20}');
+select t.item_name, jt.* from (select t1.item_name, concat(concat(concat("{\"color\": ",concat(concat("[\"",group_concat(jt.color separator "\", \"")),"\"]")),','),concat(concat("\"price\": ",jt.price),'}')) as item_props from t1, json_table(t1.item_props, '$' columns (nested path '$.color[*]' columns (color varchar(32) path '$'), price int path '$.price')) as jt group by t1.item_name, jt.price) as t, json_table(t.item_props, '$' columns (nested path '$.color[*]' columns (color varchar(32) path '$'), price int path '$.price')) as jt order by t.item_name, jt.price, jt.color;
+item_name color price
+Jeans brown 50
+Jeans green 50
+Jeans black 60
+Jeans gray 60
+Laptop black 1000
+Shirt black 20
+Shirt blue 20
+Shirt white 20
+drop table t1;
#
# End of 10.6 tests
#
diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test
index ad3770e84ce..2520c1c97ba 100644
--- a/mysql-test/suite/json/t/json_table.test
+++ b/mysql-test/suite/json/t/json_table.test
@@ -555,6 +555,17 @@ JSON_TABLE('[]', '$' COLUMNS(a TEXT PATH '$[*]')) AS jt1
ON(1)
WHERE 0;
+create table t1 (item_name varchar(32), item_props varchar(1024));
+insert into t1 values ('Jeans', '{"color": ["green", "brown"], "price": 50}');
+insert into t1 values ('Shirt', '{"color": ["blue", "white"], "price": 20}');
+insert into t1 values ('Jeans', '{"color": ["black"], "price": 60}');
+insert into t1 values ('Jeans', '{"color": ["gray"], "price": 60}');
+insert into t1 values ('Laptop', '{"color": ["black"], "price": 1000}');
+insert into t1 values ('Shirt', '{"color": ["black"], "price": 20}');
+
+select t.item_name, jt.* from (select t1.item_name, concat(concat(concat("{\"color\": ",concat(concat("[\"",group_concat(jt.color separator "\", \"")),"\"]")),','),concat(concat("\"price\": ",jt.price),'}')) as item_props from t1, json_table(t1.item_props, '$' columns (nested path '$.color[*]' columns (color varchar(32) path '$'), price int path '$.price')) as jt group by t1.item_name, jt.price) as t, json_table(t.item_props, '$' columns (nested path '$.color[*]' columns (color varchar(32) path '$'), price int path '$.price')) as jt order by t.item_name, jt.price, jt.color;
+
+drop table t1;
--echo #
--echo # End of 10.6 tests