summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/gcol/t/main_mysqldump.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/gcol/t/main_mysqldump.test')
-rw-r--r--mysql-test/suite/gcol/t/main_mysqldump.test44
1 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/suite/gcol/t/main_mysqldump.test b/mysql-test/suite/gcol/t/main_mysqldump.test
new file mode 100644
index 00000000..c2b4efd0
--- /dev/null
+++ b/mysql-test/suite/gcol/t/main_mysqldump.test
@@ -0,0 +1,44 @@
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+
+CREATE DATABASE dump_generated;
+USE dump_generated;
+CREATE TABLE t1 (pk INTEGER, a INTEGER, b INTEGER, c VARCHAR(16),
+ sum INTEGER GENERATED ALWAYS AS (a+b),
+ sub VARCHAR(4) GENERATED ALWAYS AS (SUBSTRING(c, 1, 4)),
+ key k1(sum),
+ key k2(sub)
+) engine=innodb;
+INSERT INTO t1(pk, a, b, c) VALUES (1, 11, 12, 'oneone'), (2, 21, 22, 'twotwo');
+SELECT * FROM t1;
+--exec $MYSQL_DUMP dump_generated t1 > $MYSQLTEST_VARDIR/tmp/t1.sql
+DELETE FROM t1;
+--exec $MYSQL dump_generated < $MYSQLTEST_VARDIR/tmp/t1.sql
+SELECT * FROM t1;
+--exec $MYSQL_DUMP dump_generated t1 --tab=$MYSQLTEST_VARDIR/tmp/
+DELETE FROM t1;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t1
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo # A table with regular columns after generated
+CREATE TABLE t2 (pk INTEGER, a INTEGER, b INTEGER,
+ sum INTEGER GENERATED ALWAYS AS (a+b),
+ c VARCHAR(16),
+ key k1(sum)
+) engine=innodb;
+INSERT INTO t2(pk, a, b, c) VALUES (1, 11, 12, 'oneone'), (2, 21, 22, 'twotwo');
+SELECT * FROM t2;
+--exec $MYSQL_DUMP dump_generated t2 > $MYSQLTEST_VARDIR/tmp/t2.sql
+DELETE FROM t2;
+--exec $MYSQL dump_generated < $MYSQLTEST_VARDIR/tmp/t2.sql
+SELECT * FROM t2;
+--exec $MYSQL_DUMP dump_generated t2 --tab=$MYSQLTEST_VARDIR/tmp/
+DELETE FROM t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t2.txt' INTO TABLE t2
+SELECT * FROM t2;
+DROP TABLE t2;
+
+DROP DATABASE dump_generated;