~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/case.result

  • Committer: Stewart Smith
  • Date: 2009-05-15 06:57:12 UTC
  • mto: (991.1.5 for-brian)
  • mto: This revision was merged to the branch mainline in revision 1022.
  • Revision ID: stewart@flamingspork.com-20090515065712-bmionylacjmexmmm
Make sql_mode=NO_AUTO_VALUE_ON_ZERO default for Drizzle.

Also fix DEFAULT keyword handling for auto-increment so that it defaults to
NULL and not 0 so that the following is valid and generates two auto-inc
values:

create table t1 (a int auto_increment primary key)
insert into t1 (a) values (default);
insert into t1 (a) values (default);

Important to note that 0 is no longer magic. So this gives you duplicate
primary key error:

insert into t1 (a) values(0);
insert into t1 (a) values(0);

as you've inserted the explicit value of 0 twice.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
(CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0
39
39
2.00
40
40
select case 1/0 when "a" then "true" else "false" END;
41
 
ERROR 22012: Division by 0
 
41
case 1/0 when "a" then "true" else "false" END
 
42
false
 
43
Warnings:
 
44
Error   1365    Division by 0
42
45
select case 1/0 when "a" then "true" END;
43
 
ERROR 22012: Division by 0
 
46
case 1/0 when "a" then "true" END
 
47
NULL
 
48
Warnings:
 
49
Error   1365    Division by 0
44
50
select (case 1/0 when "a" then "true" END);
45
 
ERROR 22012: Division by 0
 
51
(case 1/0 when "a" then "true" END)
 
52
NULL
 
53
Warnings:
 
54
Error   1365    Division by 0
46
55
select (case 1/0 when "a" then "true" END) + 0.0;
47
 
ERROR 22012: Division by 0
 
56
(case 1/0 when "a" then "true" END) + 0.0
 
57
NULL
 
58
Warnings:
 
59
Error   1365    Division by 0
48
60
select case when 1>0 then "TRUE" else "FALSE" END;
49
61
case when 1>0 then "TRUE" else "FALSE" END
50
62
TRUE
94
106
SHOW CREATE TABLE t1;
95
107
Table   Create Table
96
108
t1      CREATE TABLE `t1` (
97
 
  `c1` VARCHAR(1) COLLATE utf8_bin DEFAULT NULL,
98
 
  `c2` VARCHAR(1) COLLATE utf8_bin DEFAULT NULL,
99
 
  `c3` VARBINARY(4) NOT NULL,
100
 
  `c4` VARBINARY(4) NOT NULL,
101
 
  `c5` VARBINARY(4) NOT NULL,
102
 
  `c6` VARBINARY(4) NOT NULL,
103
 
  `c7` DECIMAL(2,1) NOT NULL,
104
 
  `c8` DECIMAL(2,1) NOT NULL,
105
 
  `c9` DECIMAL(2,1) DEFAULT NULL,
106
 
  `c10` DOUBLE NOT NULL,
107
 
  `c11` DOUBLE NOT NULL,
108
 
  `c12` VARBINARY(5) NOT NULL
109
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
109
  `c1` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
 
110
  `c2` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
 
111
  `c3` varbinary(4) NOT NULL,
 
112
  `c4` varbinary(4) NOT NULL,
 
113
  `c5` varbinary(4) NOT NULL,
 
114
  `c6` varbinary(4) NOT NULL,
 
115
  `c7` decimal(2,1) NOT NULL,
 
116
  `c8` decimal(2,1) NOT NULL,
 
117
  `c9` decimal(2,1) DEFAULT NULL,
 
118
  `c10` double NOT NULL,
 
119
  `c11` double NOT NULL,
 
120
  `c12` varbinary(5) NOT NULL
 
121
) ENGINE=DEFAULT
110
122
DROP TABLE t1;
111
123
SELECT CASE 
112
124
WHEN 1 
144
156
SHOW CREATE TABLE t1;
145
157
Table   Create Table
146
158
t1      CREATE TABLE `t1` (
147
 
  `COALESCE(1)` INT NOT NULL,
148
 
  `COALESCE(1.0)` DECIMAL(2,1) NOT NULL,
149
 
  `COALESCE('a')` VARCHAR(1) COLLATE utf8_general_ci NOT NULL,
150
 
  `COALESCE(1,1.0)` DECIMAL(2,1) NOT NULL,
151
 
  `COALESCE(1,'1')` VARBINARY(4) NOT NULL,
152
 
  `COALESCE(1.1,'1')` VARBINARY(4) NOT NULL,
153
 
  `COALESCE('a' COLLATE utf8_bin,'b')` VARCHAR(1) COLLATE utf8_bin DEFAULT NULL
154
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
159
  `COALESCE(1)` int NOT NULL,
 
160
  `COALESCE(1.0)` decimal(2,1) NOT NULL,
 
161
  `COALESCE('a')` varchar(1) NOT NULL,
 
162
  `COALESCE(1,1.0)` decimal(2,1) NOT NULL,
 
163
  `COALESCE(1,'1')` varbinary(4) NOT NULL,
 
164
  `COALESCE(1.1,'1')` varbinary(4) NOT NULL,
 
165
  `COALESCE('a' COLLATE utf8_bin,'b')` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
 
166
) ENGINE=DEFAULT
155
167
DROP TABLE t1;
156
168
SELECT 'case+union+test'
157
169
UNION 
194
206
2.00    2       NULL
195
207
DROP TABLE t1,t2;
196
208
End of 4.1 tests
197
 
create table t1 (a int, b bigint unsigned);
 
209
create table t1 (a int, b bigint);
198
210
create table t2 (c int);
199
211
insert into t1 (a, b) values (1,4572794622775114594), (2,18196094287899841997),
200
212
(3,11120436154190595086);