mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
62 lines
1.1 KiB
Text
62 lines
1.1 KiB
Text
#
|
|
# 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 IGNORE 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;
|