diff options
Diffstat (limited to 'mysql-test/suite/galera/t/galera_enum.test')
-rw-r--r-- | mysql-test/suite/galera/t/galera_enum.test | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mysql-test/suite/galera/t/galera_enum.test b/mysql-test/suite/galera/t/galera_enum.test new file mode 100644 index 00000000000..ff5332486aa --- /dev/null +++ b/mysql-test/suite/galera/t/galera_enum.test @@ -0,0 +1,62 @@ +# +# Test the ENUM column type, as it is frequently an unwanted child +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# ENUM as key +# + +--connection node_1 +CREATE TABLE t1 (f1 ENUM('', 'one', 'two'), KEY (f1)) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (''); +INSERT INTO t1 VALUES ('one'), ('two'); +INSERT INTO t1 VALUES (0), (1), (2); + +--connection node_2 +SELECT COUNT(*) = 6 FROM t1; +SELECT COUNT(*) = 2 FROM t1 where f1 = ''; +SELECT COUNT(*) = 2 FROM t1 where f1 = 'one'; + +DROP TABLE t1; + +# +# ENUM as PK +# + +--connection node_1 +CREATE TABLE t1 (f1 ENUM('', 'one', 'two', 'three', 'four') PRIMARY KEY) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (''), ('one'), ('two'); + +--connection node_2 +SELECT COUNT(*) = 3 FROM t1; +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = ''; + +# Conflict + +--connection node_1 +SET AUTOCOMMIT=OFF; +START TRANSACTION; +UPDATE t1 SET f1 = 'three' where f1 = ''; + +--connection node_2 +SET AUTOCOMMIt=OFF; +START TRANSACTION; +UPDATE t1 SET f1 = 'four' where f1 = ''; + +--connection node_1 +COMMIT; + +--connection node_2 +--error ER_LOCK_DEADLOCK +COMMIT; + +--connection node_1 + +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'three'; + +DROP TABLE t1; |