~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/func_math.test

  • Committer: Monty Taylor
  • Date: 2008-11-16 05:36:13 UTC
  • mto: (584.1.9 devel)
  • mto: This revision was merged to the branch mainline in revision 589.
  • Revision ID: monty@inaugust.com-20081116053613-bld4rqxhlkb49c02
Split out cache_row and type_holder.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
18
18
select abs(-10), sign(-5), sign(5), sign(0);
19
19
explain extended select abs(-10), sign(-5), sign(5), sign(0);
20
 
--error ER_DIVISION_BY_ZERO
21
20
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
22
21
explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
23
 
--error ER_DIVISION_BY_ZERO
24
22
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
25
23
explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
26
 
--error ER_DIVISION_BY_ZERO
27
24
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
28
25
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
29
 
--error ER_DIVISION_BY_ZERO
30
26
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
31
27
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
32
28
select pow(10,log10(10)),power(2,4);
33
29
explain extended select pow(10,log10(10)),power(2,4);
 
30
set @@rand_seed1=10000000,@@rand_seed2=1000000;
 
31
select rand(999999),rand();
 
32
explain extended select rand(999999),rand();
34
33
select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
35
34
explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
36
35
select degrees(pi()),radians(360);
67
66
 
68
67
explain extended select degrees(pi()),radians(360);
69
68
 
 
69
#
 
70
# Bug #7281: problem with rand()
 
71
#
 
72
 
 
73
--error 1054
 
74
select rand(rand);
 
75
 
70
76
# End of 4.1 tests
71
77
 
72
78
#
102
108
#
103
109
select abs(-2) * -2;
104
110
 
 
111
#
 
112
# Bug #6172 RAND(a) should only accept constant values as arguments
 
113
#
 
114
CREATE TABLE t1 (a INT);
 
115
 
 
116
INSERT INTO t1 VALUES (1),(1),(1),(2);
 
117
SELECT RAND(2) * 1000, RAND(a) * 1000 FROM t1;
 
118
SELECT RAND(2) * 1000, RAND(a) * 1000 FROM t1 WHERE a = 1;
 
119
INSERT INTO t1 VALUES (3);
 
120
SELECT RAND(2) * 1000, RAND(a) * 1000 FROM t1;
 
121
SELECT RAND(2) * 1000, RAND(a) * 1000 FROM t1 WHERE a = 1;
 
122
 
 
123
DROP TABLE t1;  
 
124
 
 
125
#
 
126
# Bug #14009: use of abs() on null value causes problems with filesort
 
127
#
 
128
# InnoDB is required to reproduce the fault, but it is okay if we default to
 
129
# MyISAM when testing.
 
130
--disable_warnings
 
131
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb;
 
132
--enable_warnings
 
133
insert into t1 values ('http://www.foo.com/', now());
 
134
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
 
135
drop table t1;
 
136
 
105
137
# End of 4.1 tests
106
138
 
107
139
#
121
153
#
122
154
# Bug#16678 FORMAT gives wrong result if client run with default-character-set=utf8
123
155
#
124
 
create TEMPORARY table t1
 
156
create table t1
125
157
(f1 varchar(32) not null,
126
158
 f2 int not null,
127
159
 f3 int not null default '0')
128
160
engine=myisam;
129
161
insert into t1 values ('zombie',0,0),('gold',1,10000),('silver',2,10000);
130
162
 
131
 
create TEMPORARY table t2
 
163
create table t2
132
164
(f1 int not null,
133
165
 f2 int not null,
134
166
 f3 int not null)