File: type_set.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (134 lines) | stat: -rw-r--r-- 3,969 bytes parent folder | download
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
 #Get deafult engine value
--let $DEFAULT_ENGINE = `select @@global.default_storage_engine`

#
# Test of SET with space
#

create table t1 (a set (' ','a','b') not null);

#Replace default engine value with static engine string 
--replace_result $DEFAULT_ENGINE ENGINE
show create table t1;
drop table t1;
create table t1 (a set (' ','a','b ') not null default 'b ');
drop table t1;

#
# Check that SET is case sensitive with a binary collation
#
set names latin1;
--character_set latin1
create table t1 (s set ('a','A') character set latin1 collate latin1_bin);

#Replace default engine value with static engine string 
--replace_result $DEFAULT_ENGINE ENGINE
show create table t1;
insert into t1 values ('a'),('a,A'),('A,a'),('A');
select s from t1 order by s;
select s from t1 order by concat(s);
drop table t1;

#
# Check that SET honors a more complex collation correctly
#
CREATE TABLE t1 (c set('ae','oe','ue','ss') collate latin1_german2_ci);
INSERT INTO t1 VALUES (''),(''),(''),('');
INSERT INTO t1 VALUES ('ae'),('oe'),('ue'),('ss');
INSERT INTO t1 VALUES (',,,');
INSERT INTO t1 VALUES ('ae,oe,ue,ss');
SELECT c FROM t1 ORDER BY c;
SELECT c FROM t1 ORDER BY concat(c);
DROP TABLE t1;

# End of 4.1 tests

#
# Bug#27069 set with identical elements are created
#
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
--error 1097
create table t1(f1
set('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','128'));
create table t1(f1
set('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','1'));

#Replace default engine value with static engine string 
--replace_result $DEFAULT_ENGINE ENGINE
show create table t1;
drop table t1;
SET sql_mode = default;
#
# Bug#15409: Columns with SET datatype with 64-element sets
#            may not be updated with integers
#

let $i=64;
let $s='$i';
dec $i;
while ($i) {
  let $s='$i',$s;
  dec $i;
}
--eval CREATE TABLE t1(c set($s))
INSERT INTO t1 VALUES(7); 
INSERT INTO t1 VALUES(9223372036854775808);
SELECT * FROM t1;
DROP TABLE t1;

#
# Bug #38701: Crash in String::append when inserting duplicate empty strings
# an uft8 SET col
#

CREATE TABLE t1 (
        set_unique_utf8 set ('a','b','c','d','e','f','g','h','i','j','k','l',
                             'm','n','o','p','q','r','s','t','u','v','w','x',
                             'y','z') CHARACTER SET utf8,
        unique (set_unique_utf8)
);

INSERT INTO t1 ( set_unique_utf8 ) VALUES ( '' );
--error ER_DUP_ENTRY 
INSERT INTO t1 ( set_unique_utf8 ) VALUES ( '' );

DROP TABLE t1;


--echo End of 5.0 tests

#
# Bug#18020499: LOAD DATA INTO A SET WITH EXACTLY 64 ELEMENTS GIVES BOGUS ERRORS
#
CREATE TABLE bar(id
set('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'));
INSERT INTO bar VALUES ("100");
SELECT * FROM bar;
DROP TABLE bar; 

--echo #
--echo # Bug #31019130 CASTING DOUBLE TO LONGLONG CAUSES UB
--echo #               IN FIELD_*::STORE(DOUBLE)
--echo #

CREATE TABLE t_double (a double not null);
INSERT INTO t_double (a) VALUES
(-20000000000000000000000000000.0001), (20000000000000000000000000000.0001);

CREATE TABLE t_set (
  b set('up', 'down')
);
INSERT IGNORE INTO t_set (b) SELECT a from t_double;
SELECT b FROM t_set;

DROP TABLE t_double, t_set;