summaryrefslogtreecommitdiff
path: root/mysql-test/suite/vcol
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-06-19 10:49:00 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-06-19 10:49:00 +0300
commit02979daab48d871e8c43a227b8f4462128439f17 (patch)
tree21dba14f0073df2328677ed0a90a3596f043bdeb /mysql-test/suite/vcol
parentefbfcc8b73d9fd8bafd86ab387e0c1edd39e208b (diff)
parent192aa295b4bc877d0fed24154c57304c3f789179 (diff)
downloadmariadb-git-02979daab48d871e8c43a227b8f4462128439f17.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/suite/vcol')
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result42
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test42
2 files changed, 78 insertions, 6 deletions
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index c3321872a45..6afdd120d26 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -223,10 +223,10 @@ drop table t1;
create table t1 (a int, b int);
insert into t1 values (3, 30), (4, 20), (1, 20);
create table t2 (c int, d int, v int as (d+1), index idx(c));
-insert into t2(c,d) values
+insert into t2(c,d) values
(20, 100), (20, 300), (30, 100), (30, 200), (40, 500),
(70, 100), (40, 300), (60, 100), (40, 100), (70, 100);
-insert into t2(c,d) values
+insert into t2(c,d) values
(120, 100), (150, 300), (130, 100), (130, 200), (140, 500),
(170, 100), (180, 300), (160, 100), (40, 100), (170, 100);
set join_cache_level=6;
@@ -443,5 +443,43 @@ ERROR HY000: Incorrect information in file: './test/t1.frm'
ALTER TABLE t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
#
+# MDEV-19771 REPLACE on table with virtual_field can cause crash in set_ok_status()
+
+create or replace table t1 (pk int primary key, col_bit bit(15) default null,
+vcol_bit bit(10) GENERATED ALWAYS AS (`col_bit`) VIRTUAL);
+replace INTO `t1` (`pk`,col_bit) VALUES (99,1000);
+select pk, col_bit+0, vcol_bit+0 from t1;
+pk col_bit+0 vcol_bit+0
+99 1000 1000
+replace INTO `t1` (`pk`,col_bit) VALUES (99,10000);
+select pk, col_bit+0, vcol_bit+0 from t1;
+pk col_bit+0 vcol_bit+0
+99 10000 1023
+REPLACE LOW_PRIORITY INTO `t1` (`pk`) VALUES (99);
+Warnings:
+Warning 1264 Out of range value for column 'vcol_bit' at row 1
+drop table t1;
+#
+# MDEV-17837 REPLACE on table with virtual_field can cause crash in set_ok_status()
+#
+SET @old_sql_mode=@@sql_mode;
+SET sql_mode= STRICT_ALL_TABLES;
+CREATE TABLE t1 (
+pk INT,
+i TINYINT,
+vi TINYINT AS (i+1) PERSISTENT,
+PRIMARY KEY(pk)
+);
+INSERT INTO t1 (pk,i) VALUES (1,1);
+TRUNCATE TABLE t1;
+INSERT IGNORE INTO t1 (pk,i) VALUES (1,127);
+Warnings:
+Warning 1264 Out of range value for column 'vi' at row 1
+REPLACE INTO t1 (pk,i) VALUES (1,2);
+Warnings:
+Warning 1264 Out of range value for column 'vi' at row 1
+DROP TABLE t1;
+SET @sql_mode=@old_sql_mode;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
index 4e6bd169b7d..39f4f4142e6 100644
--- a/mysql-test/suite/vcol/t/vcol_misc.test
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -232,12 +232,12 @@ drop table t1;
create table t1 (a int, b int);
insert into t1 values (3, 30), (4, 20), (1, 20);
create table t2 (c int, d int, v int as (d+1), index idx(c));
-insert into t2(c,d) values
+insert into t2(c,d) values
(20, 100), (20, 300), (30, 100), (30, 200), (40, 500),
- (70, 100), (40, 300), (60, 100), (40, 100), (70, 100);
-insert into t2(c,d) values
+ (70, 100), (40, 300), (60, 100), (40, 100), (70, 100);
+insert into t2(c,d) values
(120, 100), (150, 300), (130, 100), (130, 200), (140, 500),
- (170, 100), (180, 300), (160, 100), (40, 100), (170, 100);
+ (170, 100), (180, 300), (160, 100), (40, 100), (170, 100);
set join_cache_level=6;
explain
@@ -409,5 +409,39 @@ ALTER TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.frm
--echo #
+--echo # MDEV-19771 REPLACE on table with virtual_field can cause crash in set_ok_status()
+--echo
+
+create or replace table t1 (pk int primary key, col_bit bit(15) default null,
+ vcol_bit bit(10) GENERATED ALWAYS AS (`col_bit`) VIRTUAL);
+replace INTO `t1` (`pk`,col_bit) VALUES (99,1000);
+select pk, col_bit+0, vcol_bit+0 from t1;
+replace INTO `t1` (`pk`,col_bit) VALUES (99,10000);
+select pk, col_bit+0, vcol_bit+0 from t1;
+REPLACE LOW_PRIORITY INTO `t1` (`pk`) VALUES (99);
+drop table t1;
+
+--echo #
+--echo # MDEV-17837 REPLACE on table with virtual_field can cause crash in set_ok_status()
+--echo #
+
+SET @old_sql_mode=@@sql_mode;
+SET sql_mode= STRICT_ALL_TABLES;
+
+CREATE TABLE t1 (
+ pk INT,
+ i TINYINT,
+ vi TINYINT AS (i+1) PERSISTENT,
+ PRIMARY KEY(pk)
+);
+
+INSERT INTO t1 (pk,i) VALUES (1,1);
+TRUNCATE TABLE t1;
+INSERT IGNORE INTO t1 (pk,i) VALUES (1,127);
+REPLACE INTO t1 (pk,i) VALUES (1,2);
+DROP TABLE t1;
+SET @sql_mode=@old_sql_mode;
+
+--echo #
--echo # End of 10.2 tests
--echo #