diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-04-21 13:17:17 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-05-08 17:43:57 -0400 |
commit | 3331d4e07efca993b3f34fa06b8a03b41b6b690d (patch) | |
tree | 33ec8ad535c4003ce4e7bda050641cb748b35a04 /mysql-test/suite/galera/t/galera_enum.test | |
parent | 608a1ce5b184f617d45c69095e1fae7b39402853 (diff) | |
download | mariadb-git-3331d4e07efca993b3f34fa06b8a03b41b6b690d.tar.gz |
Merge galera tests from github.com/codership/mysql-wsrep
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; |