summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera/t/galera_zero_length_column.test
blob: 6ae81a83271c25d83a6bbdddccb5b3f6d20f7260 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
# Test columns with size zero. This is known to have tripped other storage engines.
# Keys are not allowed on such columns
#

--source include/galera_cluster.inc
--source include/have_innodb.inc

--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY , f2 VARCHAR(0)) ENGINE=InnoDB;
CREATE TABLE t2 (f1 VARCHAR(0)) ENGINE=InnoDB;


INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (2, '');

INSERT INTO t2 VALUES (NULL);
INSERT INTO t2 VALUES ('');

--connection node_2
SELECT COUNT(*) = 2 FROM t1;
SELECT f2 IS NULL FROM t1 WHERE f1 = 1;
SELECT f2 = '' FROM t1 WHERE f1 = 2;

SELECT COUNT(*) = 2 FROM t2;
SELECT f1 IS NULL FROM t2 WHERE f1 IS NULL;
SELECT f1 = '' FROM t2 WHERE f1 IS NOT NULL;

UPDATE t1 SET f2 = '' WHERE f1 = 1;
UPDATE t1 SET f2 = NULL WHERE f1 = 2;

UPDATE t2 SET f1 = '' WHERE f1 IS NULL;

--connection node_1
SELECT f2 = '' FROM t1 WHERE f1 = 1;
SELECT f2 IS NULL FROM t1 WHERE f1 = 2;

SELECT COUNT(*) = 2 FROM t2 WHERE f1 = '';

DROP TABLE t1;
DROP TABLE t2;