From 399e14f066a4007f50c0060fe55f9b35949651ba Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 13 Aug 2017 01:08:30 +0200 Subject: MDEV-13435 Crash when selecting virtual columns generated using JSON functions don't allocate memory on thd->mem_root in every fix_fields(), do it once and reuse. --- mysql-test/suite/vcol/r/wrong_arena.result | 9 +++++++++ mysql-test/suite/vcol/t/wrong_arena.test | 11 +++++++++++ 2 files changed, 20 insertions(+) (limited to 'mysql-test/suite') diff --git a/mysql-test/suite/vcol/r/wrong_arena.result b/mysql-test/suite/vcol/r/wrong_arena.result index e86026852e4..c105a069b7f 100644 --- a/mysql-test/suite/vcol/r/wrong_arena.result +++ b/mysql-test/suite/vcol/r/wrong_arena.result @@ -59,3 +59,12 @@ a b Warnings: Warning 1292 Incorrect datetime value: '1' drop table t1; +create table t1 ( +id int not null , +js varchar(1000) not null, +t time AS (cast(json_value(json_extract(js,concat('$.singleDay."', dayname(curdate()),'"')),'$.start') as time)) virtual); +insert into t1(id,js) values (0, '{"default" : {"start": "00:00:00", "end":"23:59:50"}}'); +select * from t1; +id js t +0 {"default" : {"start": "00:00:00", "end":"23:59:50"}} NULL +drop table t1; diff --git a/mysql-test/suite/vcol/t/wrong_arena.test b/mysql-test/suite/vcol/t/wrong_arena.test index 340634422ae..3d65dac9219 100644 --- a/mysql-test/suite/vcol/t/wrong_arena.test +++ b/mysql-test/suite/vcol/t/wrong_arena.test @@ -37,3 +37,14 @@ disconnect con1; connection default; select * from t1; drop table t1; + +# +# MDEV-13435 Crash when selecting virtual columns generated using JSON functions +# +create table t1 ( + id int not null , + js varchar(1000) not null, + t time AS (cast(json_value(json_extract(js,concat('$.singleDay."', dayname(curdate()),'"')),'$.start') as time)) virtual); +insert into t1(id,js) values (0, '{"default" : {"start": "00:00:00", "end":"23:59:50"}}'); +select * from t1; +drop table t1; -- cgit v1.2.1