~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/t/type_enum.test

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#
31
31
 
32
32
create table t1 (a enum ('0','1'));
33
 
--error 1691 # Bad enum
 
33
--error ER_INVALID_ENUM_VALUE # Bad enum
34
34
insert into t1 set a='foobar';
35
35
select * from t1;
36
36
update t1 set a = replace(a,'x','y');
37
37
select * from t1;
38
38
drop table t1;
39
39
 
40
 
##
41
 
## Bug #2077
42
 
##
43
 
#create table t1 (a enum(0xE4, '1', '2') not null default 0xE4);
44
 
#show columns from t1;
45
 
#show create table t1;
46
 
#drop table t1;
47
 
 
48
 
# Test currently turned off because of this bug:
49
 
# Bug 308841 queries with German umlauts in insert statem
50
 
#
 
40
#
 
41
# Bug #2077
 
42
# Drizzle -> We only handle UTF-8 for ENUM names.
 
43
#
 
44
--error ER_CORRUPT_TABLE_DEFINITION
 
45
create table t1 (a enum(0xE4, '1', '2') not null default 0xE4);
 
46
 
 
47
# and now with what it's meant to be doing (from looking at mysql result)
 
48
create table t1 (a enum(0xC3A4, '1', '2') not null default 0xC3A4);
 
49
show columns from t1;
 
50
show create table t1;
 
51
drop table t1;
 
52
 
 
53
 
51
54
# Bug #5628 German characters in field-defs will be '?'
52
55
# with some table definitions
53
56
#
54
 
#set names latin1;
55
 
#CREATE TABLE t1 (
56
 
#  a INT  default 1,
57
 
#  b ENUM('value','���_value','���') character set latin1 NOT NULL
58
 
#);
59
 
#show create table t1;
60
 
#show columns from t1;
61
 
#drop table t1;
62
 
 
63
 
# Test currently turned off because of this bug:
64
 
# Bug 308841 queries with German umlauts in insert statem
65
 
#CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate utf8_swedish_ci);
66
 
#INSERT INTO t1 VALUES ('�'),('�'),('�'),('�');
67
 
#SELECT * FROM t1;
68
 
#DROP TABLE t1;
69
 
 
70
 
# Test currently turned off because of this bug:
71
 
# Bug 308841 queries with German umlauts in insert statements fail
 
57
# Drizzle -> We only handle UTF-8 for ENUM names.
72
58
#
73
 
# Bug #6379: ENUM values are incorrectly converted
 
59
--error ER_CORRUPT_TABLE_DEFINITION
 
60
CREATE TABLE t1 (
 
61
  a INT  default 1,
 
62
  b ENUM('value','���_value','���') NOT NULL
 
63
);
 
64
 
 
65
# in utf8 land we don't convert � into ae to store in latin1 encoding.
 
66
# I think this is correct.
 
67
CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate utf8_unicode_ci);
 
68
--error ER_INVALID_ENUM_VALUE
 
69
INSERT INTO t1 VALUES ('�');
 
70
--error ER_INVALID_ENUM_VALUE
 
71
INSERT INTO t1 values ('�');
 
72
--error ER_INVALID_ENUM_VALUE
 
73
INSERT INTO t1 values ('�');
 
74
--error ER_INVALID_ENUM_VALUE
 
75
INSERT INTO t1 values ('�');
 
76
SELECT * FROM t1;
 
77
DROP TABLE t1;
 
78
 
 
79
# MySQL Bug #6379: ENUM values are incorrectly converted
74
80
#
75
81
# Check latin1 -> utf8 conversion
76
 
#
77
 
#CREATE TABLE t1 (
78
 
#  a ENUM('�','�','�') character set utf8 default '�'
79
 
#);
80
 
#show create table t1;
81
 
#insert into t1 values ('�'), ('�'), ('�');
82
 
#select a from t1 order by a;
83
 
#drop table t1;
 
82
# (this is semi-pointless for Drizzle)
 
83
#
 
84
# Drizzle -> We only handle UTF-8 for ENUM names.
 
85
#
 
86
--error ER_CORRUPT_TABLE_DEFINITION
 
87
CREATE TABLE t1 (
 
88
  a ENUM('�','�','�') default '�'
 
89
);
84
90
 
85
91
# Test currently turned off because of this bug:
86
92
# Bug 308841 queries with German umlauts in insert statements fail
88
94
# Now check utf8 -> latin1 conversion
89
95
# This test emulates loading a script generated with mysqldump
90
96
#
91
 
#CREATE TABLE t1 (
92
 
#  a ENUM('ä','ö','ü') character set latin1 default 'ü'
93
 
#);
94
 
#insert into t1 values ('ä'),('ö'),('ü');
 
97
# (this is semi pointless with Drizzle as we're just UTF8... but syntax should work)
 
98
#
 
99
CREATE TABLE t1 (
 
100
  a ENUM('ä','ö','ü') default 'ü'
 
101
);
 
102
insert into t1 values ('ä'),('ö'),('ü');
95
103
# Now check what has been loaded
96
 
#show create table t1;
97
 
#select a from t1 order by a;
98
 
#drop table t1;
 
104
show create table t1;
 
105
select a from t1 order by a;
 
106
drop table t1;
99
107
 
100
108
#
101
109
# Test bug where enum fields where extended for each ALTER TABLE
120
128
#
121
129
# Bug#24660 "enum" field type definition problem
122
130
#
123
 
#create table t1(russian enum('E','F','E�F','F�E') NOT NULL DEFAULT'E');
124
 
#show create table t1;
125
 
#drop table t1;
126
 
#
127
 
#create table t1(denormal enum('E','F','E,F','F,E') NOT NULL DEFAULT'E');
128
 
#show create table t1;
129
 
#drop table t1;
130
 
#
131
 
#create table t1(russian_deviant enum('E','F','E�F','F,E') NOT NULL DEFAULT'E');
132
 
#show create table t1;
133
 
#drop table t1;
 
131
# Drizzle -> We only handle UTF-8 for ENUM names.
 
132
#
 
133
--error ER_CORRUPT_TABLE_DEFINITION
 
134
create table t1(russian enum('E','F','E�F','F�E') NOT NULL DEFAULT'E');
 
135
 
 
136
#
 
137
create table t1(denormal enum('E','F','E,F','F,E') NOT NULL DEFAULT'E');
 
138
show create table t1;
 
139
drop table t1;
 
140
#
 
141
# Drizzle -> We only handle UTF-8 for ENUM names.
 
142
#
 
143
--error ER_CORRUPT_TABLE_DEFINITION
 
144
create table t1(russian_deviant enum('E','F','E�F','F,E') NOT NULL DEFAULT'E');
134
145
 
135
146
#
136
147
# Bug #29251: MySQL coerces special 0 enum values to normal '' value
141
152
  id INT AUTO_INCREMENT PRIMARY KEY,
142
153
  c1 ENUM('a', '', 'b')
143
154
);
144
 
--error 1691 # 0 is not valid way to insert.  Must use 1-based index of key.
 
155
--error ER_INVALID_ENUM_VALUE # 0 is not valid way to insert.  Must use 1-based index of key.
145
156
INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b');
146
 
--error 1691 # 0 is not valid way to insert.  Must use 1-based index of key.
 
157
--error ER_INVALID_ENUM_VALUE # 0 is not valid way to insert.  Must use 1-based index of key.
147
158
INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b');
148
159
INSERT INTO t1 (c1) VALUES ('a'), ('b');
149
160
SELECT id, c1 + 0, c1 FROM t1;
150
161
 
151
 
--error 1691 # Bad en
 
162
--error ER_INVALID_ENUM_VALUE # Bad en
152
163
ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL;
153
164
# Below works because '' was not inserted in any statement above...
154
165
ALTER TABLE t1 CHANGE c1 c1 ENUM('a', 'b') NOT NULL;
162
173
# Bug#28729: Field_enum wrongly reported an error while storing an empty string.
163
174
#
164
175
create table t1(f1 enum('a','b'), index(f1));
165
 
--error 1691 # Bad enum
 
176
--error ER_INVALID_ENUM_VALUE # Bad enum
166
177
insert into t1 values(''),(''),('a'),('b');
167
 
--error 1691 # Bad enum
 
178
--error ER_INVALID_ENUM_VALUE # Bad enum
168
179
select * from t1 where f1='';
169
180
drop table t1;
170
181
 
176
187
CREATE TABLE t1 (c1 ENUM('a', '', 'b'));
177
188
INSERT INTO t1 (c1) VALUES ('b');
178
189
INSERT INTO t1 (c1) VALUES ('');
179
 
--error 1691 # Bad enum 0
 
190
--error ER_INVALID_ENUM_VALUE # Bad enum 0
180
191
INSERT INTO t1 (c1) VALUES (0);
181
192
INSERT INTO t1 (c1) VALUES ('a');
182
193
 
192
203
#
193
204
 
194
205
CREATE TABLE t1(a enum('a','b','c','d'));
195
 
--error 1691 # Bad enum 0
 
206
--error ER_INVALID_ENUM_VALUE # Bad enum 0
196
207
INSERT INTO t1 VALUES (4),(1),(0),(3);
197
208
INSERT INTO t1 VALUES (4),(1),(2),(3);
198
209
 
211
222
 
212
223
ALTER TABLE t1 ADD PRIMARY KEY (a);
213
224
 
214
 
--error 1691 # Bad enum 0
 
225
--error ER_INVALID_ENUM_VALUE # Bad enum 0
215
226
EXPLAIN SELECT a FROM t1 WHERE a=0;
216
 
--error 1691 # Bad enum 0
 
227
--error ER_INVALID_ENUM_VALUE # Bad enum 0
217
228
SELECT a FROM t1 WHERE a=0;
218
229
 
219
230
DROP TABLE t1;