mariadb/mysql-test/suite/storage_engine/vcol.test
Elena Stepanova 7f444caa0a MDEV-4028 - Converted rdiff files to uniform
MDEV-11 - Modifed tests and result files to use explicit column lists
          in INSERT and SELECT statements
2013-02-03 02:53:57 +04:00

72 lines
1.5 KiB
Text

#
# Virtual columns
#
--source have_engine.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
let $create_definition = a $int_col, b $int_col GENERATED ALWAYS AS (a+1);
--source create_table.inc
if ($mysql_errname)
{
--let $my_last_stmt = $create_statement
--let $functionality = Virtual columns
--source unexpected_result.inc
}
if (!$mysql_errname)
{
--replace_column 3 # 5 #
SHOW COLUMNS IN t1;
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
--sorted_result
SELECT a,b FROM t1;
DROP TABLE t1;
let $create_definition = a $int_col, b $int_col GENERATED ALWAYS AS (a+1) PERSISTENT;
--source create_table.inc
--replace_column 3 # 5 #
SHOW COLUMNS IN t1;
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
--sorted_result
SELECT a,b FROM t1;
DROP TABLE t1;
let $create_definition = a $int_col, b $int_col GENERATED ALWAYS AS (a+1) VIRTUAL;
--source create_table.inc
--replace_column 3 # 5 #
SHOW COLUMNS IN t1;
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
--sorted_result
SELECT a,b FROM t1;
DROP TABLE t1;
let $create_definition = a $int_col, b $int_col AS (a+1) PERSISTENT;
--source create_table.inc
--replace_column 3 # 5 #
SHOW COLUMNS IN t1;
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
--sorted_result
SELECT a,b FROM t1;
DROP TABLE t1;
}
--source cleanup_engine.inc