Commit b2af0ddc authored by Sergei Golubchik's avatar Sergei Golubchik

enable innodb tests for virtual indexed columns (sic!)

collateral changes:
* remove a test from innodb_virtual_basic that is already present in
  gcol_keys_innodb
* set thd->abort_on_warning for inplace alter, just like it's set
  for copy_data_between_tables - to have warnings converted into
  errors identically in all alter algorithms
* don't ignore errors in TABLE::update_virtual_field
parent 399e14f0
......@@ -6,6 +6,19 @@ SET @@session.default_storage_engine = 'InnoDB';
# - FOREIGN INDEX (partially supported)
# - CHECK (allowed but not used)
# UNIQUE
create table t1 (a int, b int generated always as (a*2) virtual unique);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL,
UNIQUE KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
describe t1;
Field Type Null Key Default Extra
a int(11) YES NULL
b int(11) YES UNI NULL VIRTUAL GENERATED
drop table t1;
create table t1 (a int, b int generated always as (a*2) stored unique);
show create table t1;
Table Create Table
......@@ -19,6 +32,19 @@ Field Type Null Key Default Extra
a int(11) YES NULL
b int(11) YES UNI NULL STORED GENERATED
drop table t1;
create table t1 (a int, b int generated always as (a*2) virtual, unique key (b));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL,
UNIQUE KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
describe t1;
Field Type Null Key Default Extra
a int(11) YES NULL
b int(11) YES UNI NULL VIRTUAL GENERATED
drop table t1;
create table t1 (a int, b int generated always as (a*2) stored, unique (b));
show create table t1;
Table Create Table
......@@ -32,6 +58,9 @@ Field Type Null Key Default Extra
a int(11) YES NULL
b int(11) YES UNI NULL STORED GENERATED
drop table t1;
create table t1 (a int, b int generated always as (a*2) virtual);
alter table t1 add unique key (b);
drop table t1;
create table t1 (a int, b int generated always as (a*2) stored);
alter table t1 add unique key (b);
drop table t1;
......@@ -41,6 +70,21 @@ drop table t1;
# - gcol_select.inc
#
# INDEX
create table t1 (a int, b int generated always as (a*2) virtual, index (b));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL,
KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
describe t1;
Field Type Null Key Default Extra
a int(11) YES NULL
b int(11) YES MUL NULL VIRTUAL GENERATED
drop table t1;
create table t1 (a int, b int generated always as (a*2) virtual, index (a,b));
drop table t1;
create table t1 (a int, b int generated always as (a*2) stored, index (b));
show create table t1;
Table Create Table
......@@ -67,6 +111,10 @@ Field Type Null Key Default Extra
a int(11) YES MUL NULL
b int(11) YES NULL STORED GENERATED
drop table t1;
create table t1 (a int, b int generated always as (a*2) virtual);
alter table t1 add index (b);
alter table t1 add index (a,b);
drop table t1;
create table t1 (a int, b int generated always as (a*2) stored);
alter table t1 add index (b);
drop table t1;
......@@ -100,6 +148,13 @@ ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a genera
alter table t1 add foreign key (b) references t2(a) on delete set null;
ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column
drop table t1;
create table t1 (a int, b int generated always as (a+1) virtual,
foreign key (b) references t2(a));
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
create table t1 (a int, b int generated always as (a+1) virtual);
alter table t1 add foreign key (b) references t2(a);
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
drop table t1;
# Allowed FK options.
create table t2 (a int primary key, b char(5));
create table t1 (a int, b int generated always as (a % 10) stored,
......@@ -117,6 +172,168 @@ drop table t1;
create table t1 (a int, b int generated always as (a % 10) stored,
foreign key (b) references t2(a) on delete no action);
drop table t1,t2;
#
# Bug#20553262: WL8149: ASSERTION `DELSUM+(INT) Y/4-TEMP >= 0' FAILED
#
CREATE TABLE c (
pk integer AUTO_INCREMENT,
col_datetime_nokey DATETIME /*! NULL */,
col_time_nokey TIME /*! NULL */,
col_datetime_key DATETIME GENERATED ALWAYS AS
(ADDTIME(col_datetime_nokey, col_time_nokey)),
col_time_key TIME GENERATED ALWAYS AS
(ADDTIME(col_datetime_nokey, col_time_nokey)),
col_varchar_nokey VARCHAR(1) /*! NULL */,
PRIMARY KEY (pk),
KEY (col_time_key),
KEY (col_datetime_key));
INSERT INTO c ( col_time_nokey,col_datetime_nokey,col_varchar_nokey) values
('14:03:03.042673','2001-11-28 00:50:27.051028', 'c'),
('01:46:09.016386','2007-10-09 19:53:04.008332', NULL),
('16:21:18.052408','2001-11-08 21:02:12.009395', 'x'),
('18:56:33.027423','2003-04-01 00:00:00', 'i');
Warnings:
Note 1265 Data truncated for column 'col_time_key' at row 1
Note 1265 Data truncated for column 'col_time_key' at row 2
Note 1265 Data truncated for column 'col_time_key' at row 3
Note 1265 Data truncated for column 'col_time_key' at row 4
EXPLAIN SELECT
outr.col_time_key AS x
FROM c as outr
WHERE
outr.col_varchar_nokey in ('c', 'x', 'i')
AND (outr.col_time_key IS NULL OR
outr.col_datetime_key = '2009-09-27');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE outr ALL col_time_key,col_datetime_key NULL NULL NULL 4 x
SELECT
outr.col_time_key AS x
FROM c AS outr
WHERE
outr.col_varchar_nokey in ('c', 'x', 'i')
AND (outr.col_time_key IS NULL OR
outr.col_datetime_key = '2009-09-27');
x
DROP TABLE c;
#
# Bug#20913803: WL8149: SIG 11 IN DFIELD_DUP |
# INNOBASE/INCLUDE/DATA0DATA.IC:253
#
CREATE TABLE A (
col_varchar_nokey TEXT ,
col_varchar_key TEXT GENERATED ALWAYS AS (REPEAT(col_varchar_nokey, 1000)),
KEY (col_varchar_key(50))
);
INSERT INTO A (col_varchar_nokey) VALUES ('');
CREATE TABLE D (
pk INTEGER AUTO_INCREMENT,
col_date_nokey BLOB,
col_date_key BLOB GENERATED ALWAYS AS (REPEAT(col_date_nokey,1000)) VIRTUAL,
col_datetime_nokey LONGBLOB,
col_time_nokey LONGTEXT,
col_datetime_key LONGBLOB GENERATED ALWAYS AS (REPEAT(col_datetime_nokey, 1000)),
col_time_key LONGTEXT GENERATED ALWAYS AS (REPEAT(col_datetime_nokey, 1000)),
col_varchar_nokey TEXT,
col_varchar_key TEXT GENERATED ALWAYS AS (REPEAT(col_varchar_nokey, 1000)),
PRIMARY KEY (pk),
KEY (col_varchar_key(50)),
KEY (col_date_key(20)),
KEY (col_time_key(20)),
KEY (col_datetime_key(20)),
KEY (col_varchar_key(10), col_date_key(10), col_time_key(5), col_datetime_key(5))
);
INSERT INTO D (
col_date_nokey,
col_time_nokey,
col_datetime_nokey,
col_varchar_nokey
) VALUES ('', '', '', ''),('', '', '', '');
DELETE FROM OUTR1.* USING D AS OUTR1 RIGHT JOIN A AS OUTR2 ON
( OUTR1 . `col_varchar_nokey` = OUTR2 . `col_varchar_nokey` );
DROP TABLE IF EXISTS A,D;
#
# Bug#21024896: SIG 11 INNOBASE_ADD_ONE_VIRTUAL |
# INNOBASE/HANDLER/HANDLER0ALTER.CC
#
CREATE TABLE t1 (
col1 int(11) DEFAULT NULL,
col2 int(11) DEFAULT NULL,
col3 int(11) NOT NULL,
col4 int(11) DEFAULT NULL,
col5 int(11) GENERATED ALWAYS AS (col2 / col2) VIRTUAL,
col7 int(11) GENERATED ALWAYS AS (col5 + col5) VIRTUAL,
col8 int(11) GENERATED ALWAYS AS (col5 * col5) VIRTUAL,
col9 text,
col6 int(11) DEFAULT NULL,
PRIMARY KEY (`col3`),
UNIQUE KEY uidx (`col2`),
KEY idx (`col5`)
);
INSERT INTO t1(col1,col2,col3,col4,col9,col6)
VALUES(1,1,0,1,REPEAT(col1,1000),0), (3,2,1,1,REPEAT(col1,1000),NULL);
ALTER TABLE t1 ADD COLUMN extra INT;
DROP TABLE t1;
#
# Bug#21316860: WL8149:INNODB: FAILING ASSERTION:
# TEMPL->CLUST_REC_FIELD_NO != ULINT_UNDEFINED
#
CREATE TABLE t1 (
pk int(11) NOT NULL,
col_int_nokey int(11),
col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey) VIRTUAL,
col_date_nokey date,
col_date_key date GENERATED ALWAYS AS (col_date_nokey) VIRTUAL,
PRIMARY KEY (pk),
UNIQUE KEY col_int_key (col_int_key)
);
ALTER TABLE t1 DROP COLUMN pk;
DROP TABLE t1;
# Remove the impact on PK choose by index on virtual generated column
CREATE TABLE t1 (
pk int(11) NOT NULL,
col_int_nokey int(11) DEFAULT NULL,
col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey) VIRTUAL,
UNIQUE KEY col_int_key (col_int_key)
);
ALTER TABLE t1 add unique index idx(pk);
DESC t1;
Field Type Null Key Default Extra
pk int(11) NO PRI NULL
col_int_nokey int(11) YES NULL
col_int_key int(11) YES UNI NULL VIRTUAL GENERATED
DROP TABLE t1;
#
# Bug#21320151 WL8149: WRONG RESULT WITH INDEX SCAN
#
CREATE TABLE t1 (
id INTEGER NOT NULL,
b INTEGER GENERATED ALWAYS AS (id+1) VIRTUAL,
UNIQUE KEY (b)
);
INSERT INTO t1 (id) VALUES (2),(3),(4),(5),(6),(7),(8),(9),(10);
EXPLAIN SELECT b FROM t1 FORCE INDEX(b);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 9 Using index
SELECT b FROM t1 FORCE INDEX(b);
b
3
4
5
6
7
8
9
10
11
EXPLAIN SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL 3 Using where; Using index
SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5;
b
3
4
5
DROP TABLE t1;
# Testing data manipulation operations involving FOREIGN KEY
# on generated columns can be found in:
......@@ -297,6 +514,202 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE table2 eq_ref PRIMARY PRIMARY 4 test.table1.pk 1
DROP TABLE t1;
#
# Bug#21391781 ASSERT WHEN RUNNING ALTER TABLE ON A TABLE WITH INDEX
# ON VIRTUAL COLUMN
#
CREATE TABLE t1 (
col1 INTEGER NOT NULL,
col2 INTEGER NOT NULL,
gcol1 INTEGER GENERATED ALWAYS AS (col1 + col2) VIRTUAL,
col3 INTEGER NOT NULL,
col4 INTEGER NOT NULL,
col5 INTEGER DEFAULT NULL,
col6 INTEGER DEFAULT NULL,
col7 INTEGER DEFAULT NULL,
col8 INTEGER DEFAULT NULL,
col9 INTEGER DEFAULT NULL,
col10 INTEGER DEFAULT NULL,
col11 INTEGER DEFAULT NULL,
col12 INTEGER DEFAULT NULL,
col13 INTEGER DEFAULT NULL,
col14 INTEGER DEFAULT NULL,
col15 INTEGER DEFAULT NULL,
col16 INTEGER DEFAULT NULL,
col17 INTEGER DEFAULT NULL,
col18 INTEGER DEFAULT NULL,
col19 INTEGER DEFAULT NULL,
col20 INTEGER DEFAULT NULL,
col21 INTEGER DEFAULT NULL,
col22 INTEGER DEFAULT NULL,
col23 INTEGER DEFAULT NULL,
col24 INTEGER DEFAULT NULL,
col25 INTEGER DEFAULT NULL,
col26 INTEGER DEFAULT NULL,
col27 INTEGER DEFAULT NULL,
col28 INTEGER DEFAULT NULL,
col29 INTEGER DEFAULT NULL,
col30 INTEGER DEFAULT NULL,
col31 INTEGER DEFAULT NULL,
col32 INTEGER DEFAULT NULL,
col33 INTEGER DEFAULT NULL,
col34 INTEGER DEFAULT NULL,
col35 INTEGER DEFAULT NULL,
col36 INTEGER DEFAULT NULL,
col37 INTEGER DEFAULT NULL,
col38 INTEGER DEFAULT NULL,
col39 INTEGER DEFAULT NULL,
col40 INTEGER DEFAULT NULL,
col41 INTEGER DEFAULT NULL,
col42 INTEGER DEFAULT NULL,
col43 INTEGER DEFAULT NULL,
col44 INTEGER DEFAULT NULL,
col45 INTEGER DEFAULT NULL,
col46 INTEGER DEFAULT NULL,
col47 INTEGER DEFAULT NULL,
col48 INTEGER DEFAULT NULL,
col49 INTEGER DEFAULT NULL,
col50 INTEGER DEFAULT NULL,
col51 INTEGER DEFAULT NULL,
col52 INTEGER DEFAULT NULL,
col53 INTEGER DEFAULT NULL,
col54 INTEGER DEFAULT NULL,
col55 INTEGER DEFAULT NULL,
col56 INTEGER DEFAULT NULL,
col57 INTEGER DEFAULT NULL,
col58 INTEGER DEFAULT NULL,
col59 INTEGER DEFAULT NULL,
col60 INTEGER DEFAULT NULL,
col61 INTEGER DEFAULT NULL,
col62 INTEGER DEFAULT NULL,
col63 INTEGER DEFAULT NULL,
col64 INTEGER DEFAULT NULL,
col65 INTEGER DEFAULT NULL,
gcol2 INTEGER GENERATED ALWAYS AS (col3 / col4) VIRTUAL,
KEY idx1 (gcol1)
);
INSERT INTO t1 (col1, col2, col3, col4)
VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4), (5,5,5,5);
ALTER TABLE t1 ADD COLUMN extra INTEGER;
SELECT gcol1 FROM t1 FORCE INDEX(idx1);
gcol1
2
4
6
8
10
DROP TABLE t1;
CREATE TABLE t1 (
col1 INTEGER NOT NULL,
col2 INTEGER NOT NULL,
gcol1 INTEGER GENERATED ALWAYS AS (col1 + col2) VIRTUAL,
col3 INTEGER NOT NULL,
col4 INTEGER NOT NULL,
col5 INTEGER DEFAULT NULL,
col6 INTEGER DEFAULT NULL,
col7 INTEGER DEFAULT NULL,
col8 INTEGER DEFAULT NULL,
col9 INTEGER DEFAULT NULL,
col10 INTEGER DEFAULT NULL,
col11 INTEGER DEFAULT NULL,
col12 INTEGER DEFAULT NULL,
col13 INTEGER DEFAULT NULL,
col14 INTEGER DEFAULT NULL,
col15 INTEGER DEFAULT NULL,
col16 INTEGER DEFAULT NULL,
col17 INTEGER DEFAULT NULL,
col18 INTEGER DEFAULT NULL,
col19 INTEGER DEFAULT NULL,
col20 INTEGER DEFAULT NULL,
col21 INTEGER DEFAULT NULL,
col22 INTEGER DEFAULT NULL,
col23 INTEGER DEFAULT NULL,
col24 INTEGER DEFAULT NULL,
col25 INTEGER DEFAULT NULL,
col26 INTEGER DEFAULT NULL,
col27 INTEGER DEFAULT NULL,
col28 INTEGER DEFAULT NULL,
col29 INTEGER DEFAULT NULL,
col30 INTEGER DEFAULT NULL,
col31 INTEGER DEFAULT NULL,
col32 INTEGER DEFAULT NULL,
col33 INTEGER DEFAULT NULL,
col34 INTEGER DEFAULT NULL,
col35 INTEGER DEFAULT NULL,
col36 INTEGER DEFAULT NULL,
col37 INTEGER DEFAULT NULL,
col38 INTEGER DEFAULT NULL,
col39 INTEGER DEFAULT NULL,
col40 INTEGER DEFAULT NULL,
col41 INTEGER DEFAULT NULL,
col42 INTEGER DEFAULT NULL,
col43 INTEGER DEFAULT NULL,
col44 INTEGER DEFAULT NULL,
col45 INTEGER DEFAULT NULL,
col46 INTEGER DEFAULT NULL,
col47 INTEGER DEFAULT NULL,
col48 INTEGER DEFAULT NULL,
col49 INTEGER DEFAULT NULL,
col50 INTEGER DEFAULT NULL,
col51 INTEGER DEFAULT NULL,
col52 INTEGER DEFAULT NULL,
col53 INTEGER DEFAULT NULL,
col54 INTEGER DEFAULT NULL,
col55 INTEGER DEFAULT NULL,
col56 INTEGER DEFAULT NULL,
col57 INTEGER DEFAULT NULL,
col58 INTEGER DEFAULT NULL,
col59 INTEGER DEFAULT NULL,
col60 INTEGER DEFAULT NULL,
col61 INTEGER DEFAULT NULL,
col62 INTEGER DEFAULT NULL,
col63 INTEGER DEFAULT NULL,
col64 INTEGER DEFAULT NULL,
col65 INTEGER DEFAULT NULL,
gcol2 INTEGER GENERATED ALWAYS AS (col3 / col4) VIRTUAL,
KEY idx1 (gcol2)
);
INSERT INTO t1 (col1, col2, col3, col4)
VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4), (5,5,5,5);
ALTER TABLE t1 ADD COLUMN extra INTEGER;
SELECT gcol2 FROM t1 FORCE INDEX(idx1);
gcol2
1
1
1
1
1
DROP TABLE t1;
#
# Bug#21628161 CRASH/MEMORY CORRUPTION ADDING INDEXES TO VIRTUAL COLUMN
#
CREATE TABLE t (a INT,
b BOOLEAN GENERATED ALWAYS AS (a+10000) VIRTUAL,
c BLOB GENERATED ALWAYS AS (b=2) VIRTUAL);
INSERT INTO t(a) VALUES (1);
SELECT * FROM t WHERE c = '0';
a b c
1 127 0
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t ADD UNIQUE INDEX (c(1));
SELECT * FROM t WHERE c = '0';
a b c
1 127 0
DROP TABLE t;
#
# Bug#21688115 VIRTUAL COLUMN COMPUTATION SAVE_IN_FIELD()
# DID NOT RETURN TRUE WITH DIVIDE 0
#
CREATE TABLE t (a INT, b INT, h VARCHAR(10));
INSERT INTO t VALUES (12, 3, "ss");
INSERT INTO t VALUES (13, 4, "ss");
INSERT INTO t VALUES (14, 0, "ss");
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t ADD c INT GENERATED ALWAYS AS (a/b) VIRTUAL;
CREATE INDEX idx ON t(c);
ERROR 22012: Division by 0
CALL mtr.add_suppression("\\[Warning\\] InnoDB: Compute virtual column values failed");
DROP TABLE t;
#
# Bug#21770798 OPTIMIZER DOES NOT USE INDEX FOR GENERATED EXPRESSIONS
# WITH LOGICAL OPERATORS
#
......@@ -412,6 +825,65 @@ a1 a2 b
0 NULL 1
DROP TABLE t1, t2;
#
#
# BUG#21365158 WL8149:ASSERTION `!TABLE || (!TABLE->WRITE_SET
#
CREATE TABLE t1 (
pk INTEGER AUTO_INCREMENT,
col_int_nokey INTEGER NOT NULL,
col_varchar_nokey VARCHAR(1),
col_varchar_key VARCHAR(2) GENERATED ALWAYS AS
(CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL,
PRIMARY KEY (pk)
);
INSERT INTO t1 ( col_int_nokey, col_varchar_nokey)
VALUES (4, 'b'),(9, 'o'),(4, 'k'),(5, 'a'),(5, 'f'),
(9, 't'),(3, 'c'),(8, 'c'),(0, 'r'),(98, 'k');
CREATE TABLE t2 (
pk INTEGER AUTO_INCREMENT,
col_int_nokey INTEGER NOT NULL,
col_varchar_nokey VARCHAR(1) NOT NULL,
col_varchar_key VARCHAR(2) GENERATED ALWAYS AS
(CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL,
PRIMARY KEY (pk),
UNIQUE KEY (col_varchar_key)
);
INSERT INTO t2 ( col_int_nokey, col_varchar_nokey)
VALUES (1, 'c'),(8, 'm'),(9, 'd'), (6, 'y'),(1, 't'),
(2, 's'),(4, 'r');
SELECT
CONCAT( t2.col_varchar_nokey , t2.col_varchar_nokey ) AS f2,
t1.col_varchar_key AS f5
FROM
t2 LEFT JOIN t1 ON t2.col_int_nokey > t1.col_int_nokey
ORDER BY f2, f5;
f2 f5
cc rr
dd aa
dd bb
dd cc
dd cc
dd ff
dd kk
dd rr
mm aa
mm bb
mm cc
mm ff
mm kk
mm rr
rr cc
rr rr
ss rr
tt rr
yy aa
yy bb
yy cc
yy ff
yy kk
yy rr
DROP TABLE t1,t2;
#
DROP VIEW IF EXISTS v1,v2;
DROP TABLE IF EXISTS t1,t2,t3;
DROP PROCEDURE IF EXISTS p1;
......
......@@ -921,15 +921,6 @@ alter table t add unique index (c(39));
replace into t set a = 'a',b =1;
replace into t set a = 'a',b =1;
drop table t;
CREATE TABLE t (a INT, b INT, h VARCHAR(10));
INSERT INTO t VALUES (12, 3, "ss");
INSERT INTO t VALUES (13, 4, "ss");
INSERT INTO t VALUES (14, 0, "ss");
alter table t add c INT GENERATED ALWAYS AS(a/b);
create index idx on t(c);
Warnings:
Warning 1365 Division by 0
DROP TABLE t;
CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10));
INSERT INTO t VALUES (11, 3, DEFAULT, 'mm');
INSERT INTO t VALUES (18, 1, DEFAULT, 'mm');
......
......@@ -37,7 +37,7 @@ eval SET @@session.default_storage_engine = 'InnoDB';
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
let $skip_spatial_index_check = 1;
let $support_virtual_index= 0;
let $support_virtual_index= 1;
--source suite/gcol/inc/gcol_keys.inc
if ($support_virtual_index) {
......
......@@ -772,16 +772,7 @@ replace into t set a = 'a',b =1;
replace into t set a = 'a',b =1;
drop table t;
CREATE TABLE t (a INT, b INT, h VARCHAR(10));
INSERT INTO t VALUES (12, 3, "ss");
INSERT INTO t VALUES (13, 4, "ss");
INSERT INTO t VALUES (14, 0, "ss");
alter table t add c INT GENERATED ALWAYS AS(a/b);
create index idx on t(c);
DROP TABLE t;
CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10));
INSERT INTO t VALUES (11, 3, DEFAULT, 'mm');
INSERT INTO t VALUES (18, 1, DEFAULT, 'mm');
INSERT INTO t VALUES (28, 1, DEFAULT, 'mm');
......
......@@ -7179,6 +7179,7 @@ static bool mysql_inplace_alter_table(THD *thd,
HA_CREATE_INFO *create_info= ha_alter_info->create_info;
Alter_info *alter_info= ha_alter_info->alter_info;
bool reopen_tables= false;
bool res;
DBUG_ENTER("mysql_inplace_alter_table");
......@@ -7313,11 +7314,12 @@ static bool mysql_inplace_alter_table(THD *thd,
DEBUG_SYNC(thd, "alter_table_inplace_after_lock_downgrade");
THD_STAGE_INFO(thd, stage_alter_inplace);
if (table->file->ha_inplace_alter_table(altered_table,
ha_alter_info))
{
/* We can abort alter table for any table type */
thd->abort_on_warning= !ha_alter_info->ignore && thd->is_strict_mode();
res= table->file->ha_inplace_alter_table(altered_table, ha_alter_info);
thd->abort_on_warning= false;
if (res)
goto rollback;
}
// Upgrade to EXCLUSIVE before commit.
if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME))
......
......@@ -7468,7 +7468,7 @@ int TABLE::update_virtual_field(Field *vf)
vf->vcol_info->expr->walk(&Item::update_vcol_processor, 0, &tmp_set);
vf->vcol_info->expr->save_in_field(vf, 0);
in_use->restore_active_arena(expr_arena, &backup_arena);
DBUG_RETURN(0);
DBUG_RETURN(in_use->is_error());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment