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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-17226 Column Data in Truncated on UNION to the length of the first value if using REPLACE
--echo #
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (2),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
CREATE TABLE t2 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ("a", "ba");
INSERT INTO t2 (col1, col2) VALUES ("a", "ba");
SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t2;
SELECT REPLACE('z', col1, col2) FROM t1 UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT REPLACE('z', col1, col2) FROM t2 UNION ALL SELECT REPLACE('a', col1, col2) FROM t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (2),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'ba');
SELECT REPLACE('a', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (10),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', '0123456789');
SELECT REPLACE('aa', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aa', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (20),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'aaaaaaaaaabbbbbbbbbb');
SELECT REPLACE('aa', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aa', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (30),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'aaaaaaaaaabbbbbbbbbbcccccccccc');
SELECT REPLACE('aaa', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aaa', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
--echo #
--echo # End of 10.5 tests
--echo #
|