summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/gcol/t/gcol_keys_innodb.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/gcol/t/gcol_keys_innodb.test')
-rw-r--r--mysql-test/suite/gcol/t/gcol_keys_innodb.test89
1 files changed, 89 insertions, 0 deletions
diff --git a/mysql-test/suite/gcol/t/gcol_keys_innodb.test b/mysql-test/suite/gcol/t/gcol_keys_innodb.test
new file mode 100644
index 00000000..7f7c4503
--- /dev/null
+++ b/mysql-test/suite/gcol/t/gcol_keys_innodb.test
@@ -0,0 +1,89 @@
+################################################################################
+# t/gcol_keys_innodb.test #
+# #
+# Purpose: #
+# Testing keys, indexes defined upon generated columns. #
+# #
+# InnoDB branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: Andrey Zhakov #
+# Original Date: 2008-09-04 #
+# Change Author: #
+# Change Date: #
+# Change: #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+# Set the session storage engine
+--source include/have_innodb.inc
+eval SET @@session.default_storage_engine = 'InnoDB';
+
+##### Workarounds for known open engine specific bugs
+# none
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+let $skip_spatial_index_check = 1;
+let $support_virtual_index= 1;
+--source suite/gcol/inc/gcol_keys.inc
+
+if ($support_virtual_index) {
+#------------------------------------------------------------------------------#
+# Execute storage engine specific tests
+--echo #
+--echo # BUG#21365158 WL8149:ASSERTION `!TABLE || (!TABLE->WRITE_SET
+--echo #
+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;
+DROP TABLE t1,t2;
+
+--echo #
+
+}
+#------------------------------------------------------------------------------#
+# Cleanup
+--source suite/gcol/inc/gcol_cleanup.inc