~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/case.test

  • Committer: Olaf van der Spek
  • Date: 2011-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
19
19
select (CASE "two" when "one" then "1" WHEN "two" then "2" END);
20
20
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0;
 
21
--error ER_DIVISION_BY_ZERO
21
22
select case 1/0 when "a" then "true" else "false" END;
 
23
--error ER_DIVISION_BY_ZERO
22
24
select case 1/0 when "a" then "true" END;
 
25
--error ER_DIVISION_BY_ZERO
23
26
select (case 1/0 when "a" then "true" END);
 
27
--error ER_DIVISION_BY_ZERO
24
28
select (case 1/0 when "a" then "true" END) + 0.0;
25
29
select case when 1>0 then "TRUE" else "FALSE" END;
26
30
select case when 1<0 then "TRUE" else "FALSE" END;
66
70
SHOW CREATE TABLE t1;
67
71
DROP TABLE t1;
68
72
 
69
 
--error 1267
 
73
--error ER_CANT_AGGREGATE_2COLLATIONS
70
74
SELECT CASE 
71
75
  WHEN 1 
72
76
  THEN 'a' COLLATE utf8_bin 
73
77
  ELSE 'a' COLLATE utf8_swedish_ci
74
78
  END;
75
79
 
76
 
--error 1270
 
80
--error ER_CANT_AGGREGATE_3COLLATIONS
77
81
SELECT CASE 'a' COLLATE utf8_bin
78
82
  WHEN 'a' COLLATE utf8_danish_ci  THEN 1
79
83
  WHEN 'a' COLLATE utf8_swedish_ci THEN 2
96
100
#
97
101
# Check COALESCE argument types aggregation
98
102
 
99
 
--error 1267
 
103
--error ER_CANT_AGGREGATE_2COLLATIONS
100
104
CREATE TABLE t1 SELECT COALESCE('a' COLLATE utf8_swedish_ci,'b' COLLATE utf8_bin);
101
105
CREATE TABLE t1 SELECT 
102
106
 COALESCE(1), COALESCE(1.0),COALESCE('a'),
157
161
#
158
162
# #30782: Truncated BIGINT columns 
159
163
#
160
 
create table t1 (a int, b bigint);
 
164
create table t1 (a int, b bigint unsigned);
161
165
create table t2 (c int);
162
166
insert into t1 (a, b) values (1,4572794622775114594), (2,18196094287899841997),
163
167
  (3,11120436154190595086);