summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2022-07-04 20:29:36 +0300
committerNikita Malyavin <nikitamalyavin@gmail.com>2023-04-18 00:29:50 +0300
commit8ed72ccbc58b6949ae253fba78eb46705045afe9 (patch)
treebbc666ff7f55803275aacece76c49731d8050fdf
parent6f3af28178c9d1d8d1549ff401b19ceb0d0625c9 (diff)
downloadmariadb-git-8ed72ccbc58b6949ae253fba78eb46705045afe9.tar.gz
MDEV-29021 add test case from MDEV-29013
This test case was also fixed by adding update_virtual_columns.
-rw-r--r--mysql-test/main/alter_table_online_debug.result20
-rw-r--r--mysql-test/main/alter_table_online_debug.test28
2 files changed, 46 insertions, 2 deletions
diff --git a/mysql-test/main/alter_table_online_debug.result b/mysql-test/main/alter_table_online_debug.result
index e5ebe1e7a1e..11ff61250ac 100644
--- a/mysql-test/main/alter_table_online_debug.result
+++ b/mysql-test/main/alter_table_online_debug.result
@@ -650,7 +650,7 @@ set debug_sync= reset;
#
# MDEV-29021 ALTER TABLE fails when a stored virtual column is dropped and added
#
-create table t1 (a char(9), b char(9) as (a) stored) engine=InnoDB;
+create table t1 (a char(9), b char(9) as (a) stored);
insert into t1(a) values ('foobar');
set debug_sync= 'now wait_for downgraded';
connection con2;
@@ -708,6 +708,24 @@ connection default;
drop table t1;
set debug_sync= reset;
#
+# DELETE with added virtual column
+#
+CREATE TABLE t1 (a CHAR(3), b CHAR(3) AS (a));
+INSERT INTO t1 (a) VALUES ('foo'),('bar');
+set debug_sync= 'now wait_for downgraded';
+connection con2;
+set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit';
+ALTER TABLE t1 ADD c INT, ALGORITHM=COPY, LOCK=NONE;
+connection default;
+DELETE FROM t1;
+set debug_sync= 'now signal goforit';
+connection con2;
+select * from t1;
+a b c
+connection default;
+DROP TABLE t1;
+set debug_sync= reset;
+#
# Do not ignore sql_mode when replicating
#
create table t1 (a int);
diff --git a/mysql-test/main/alter_table_online_debug.test b/mysql-test/main/alter_table_online_debug.test
index e880613790f..df1c3e7d8f1 100644
--- a/mysql-test/main/alter_table_online_debug.test
+++ b/mysql-test/main/alter_table_online_debug.test
@@ -804,7 +804,7 @@ set debug_sync= reset;
--echo #
--echo # MDEV-29021 ALTER TABLE fails when a stored virtual column is dropped and added
--echo #
-create table t1 (a char(9), b char(9) as (a) stored) engine=InnoDB;
+create table t1 (a char(9), b char(9) as (a) stored);
insert into t1(a) values ('foobar');
--send set debug_sync= 'now wait_for downgraded'
@@ -876,6 +876,32 @@ drop table t1;
set debug_sync= reset;
--echo #
+--echo # DELETE with added virtual column
+--echo #
+CREATE TABLE t1 (a CHAR(3), b CHAR(3) AS (a));
+INSERT INTO t1 (a) VALUES ('foo'),('bar');
+--send
+set debug_sync= 'now wait_for downgraded';
+
+--connection con2
+set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit';
+--send
+ALTER TABLE t1 ADD c INT, ALGORITHM=COPY, LOCK=NONE;
+
+--connection default
+--reap
+DELETE FROM t1;
+set debug_sync= 'now signal goforit';
+
+--connection con2
+--reap
+select * from t1;
+
+--connection default
+DROP TABLE t1;
+set debug_sync= reset;
+
+--echo #
--echo # Do not ignore sql_mode when replicating
--echo #
create table t1 (a int);