diff options
Diffstat (limited to 'mysql-test/suite/vcol/t/vcol_misc.test')
-rw-r--r-- | mysql-test/suite/vcol/t/vcol_misc.test | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index bd868f46111..a0616d187da 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -160,3 +160,49 @@ select * from t1,t2 where t1.b=t2.c and d <= 100; set join_cache_level=default; drop table t1, t2; + +# +# Test crashes when using convert_const_item() +# +create table t1 (a bigint, b bigint as (a > '2')); +show create table t1; +insert into t1 (a) values (1),(3); +select * from t1; +select * from t1; +drop table t1; +create table t1 (a bigint, b bigint as (a between 0 and 2)); +show create table t1; +insert into t1 (a) values (1),(3); +select * from t1; +select * from t1; +drop table t1; +create table t1 (a char(10), b char(10) as (a between 0 and 2)); +show create table t1; +insert into t1 (a) values (1),(3); +select * from t1; +select * from t1; +drop table t1; + +# +# Test output of show columns +# + +CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(32) DEFAULT NULL, + `c` int(11) AS (a MOD 10) VIRTUAL, + `d` varchar(5) AS (LEFT(b,5)) PERSISTENT +) ENGINE=MyISAM; +show create table t1; +show columns from t1; +--replace_column 8 # +show full columns from t1; +INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,NULL); +UPDATE `test`.`t1` SET `d`='b' WHERE `a`='1' AND `b`='a' AND `c`='1' AND `d`='a'; +INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,'a'); +set sql_mode='strict_all_tables'; +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN +UPDATE `test`.`t1` SET `d`='b' WHERE `a`='1' AND `b`='a' AND `c`='1' AND `d`='a'; +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN +INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,'a'); +drop table t1; |