Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
803ed1a1
Commit
803ed1a1
authored
Feb 21, 2005
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests modified to coved decimal-related code
parent
1666f99b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
155 additions
and
0 deletions
+155
-0
mysql-test/r/analyse.result
mysql-test/r/analyse.result
+7
-0
mysql-test/r/cast.result
mysql-test/r/cast.result
+16
-0
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+35
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+36
-0
mysql-test/t/analyse.test
mysql-test/t/analyse.test
+8
-0
mysql-test/t/cast.test
mysql-test/t/cast.test
+8
-0
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+22
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+23
-0
No files found.
mysql-test/r/analyse.result
View file @
803ed1a1
...
@@ -102,3 +102,10 @@ select * from t1 procedure analyse();
...
@@ -102,3 +102,10 @@ select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.v " \\ 1 19 0 0 3.7619 NULL ENUM('"','""','"c','\'\0\\"','\'','\'\'','\'b','a\0\0\0b','a\0','a""""b','a\'\'\'\'b','abc','abc\'def\\hij"klm\0opq','a\\\\\\\\b','b\'','c"','d\\','The\ZEnd','\\','\\d','\\\\') NOT NULL
test.t1.v " \\ 1 19 0 0 3.7619 NULL ENUM('"','""','"c','\'\0\\"','\'','\'\'','\'b','a\0\0\0b','a\0','a""""b','a\'\'\'\'b','abc','abc\'def\\hij"klm\0opq','a\\\\\\\\b','b\'','c"','d\\','The\ZEnd','\\','\\d','\\\\') NOT NULL
drop table t1;
drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.df 1.1 2.2 8 8 0 0 1.650000000 0.302500000 ENUM('1.1','2.2') NOT NULL
drop table t1;
mysql-test/r/cast.result
View file @
803ed1a1
...
@@ -187,3 +187,19 @@ timediff(cast('2004-12-30 12:00:00' as time), '12:00:00')
...
@@ -187,3 +187,19 @@ timediff(cast('2004-12-30 12:00:00' as time), '12:00:00')
select timediff(cast('1 12:00:00' as time), '12:00:00');
select timediff(cast('1 12:00:00' as time), '12:00:00');
timediff(cast('1 12:00:00' as time), '12:00:00')
timediff(cast('1 12:00:00' as time), '12:00:00')
24:00:00
24:00:00
select cast('1.2' as decimal(3,2));
cast('1.2' as decimal(3,2))
1.20
select 1e18 * cast('1.2' as decimal(3,2));
1e18 * cast('1.2' as decimal(3,2))
1.2e+18
select cast(cast('1.2' as decimal(3,2)) as signed);
cast(cast('1.2' as decimal(3,2)) as signed)
1
set @v1=1e18;
select cast(@v1 as decimal(22, 2));
cast(@v1 as decimal(22, 2))
1000000000000000000.00
select cast(-1e18 as decimal(22,2));
cast(-1e18 as decimal(22,2))
-1000000000000000000.00
mysql-test/r/func_group.result
View file @
803ed1a1
...
@@ -769,3 +769,38 @@ show columns from t2;
...
@@ -769,3 +769,38 @@ show columns from t2;
Field Type Null Key Default Extra
Field Type Null Key Default Extra
f2 datetime NO 0000-00-00 00:00:00
f2 datetime NO 0000-00-00 00:00:00
drop table t2, t1;
drop table t2, t1;
create table t2 (ff double);
insert into t2 values (2.2);
select cast(sum(distinct ff) as decimal(5,2)) from t2;
cast(sum(distinct ff) as decimal(5,2))
2.20
select cast(sum(distinct ff) as signed) from t2;
cast(sum(distinct ff) as signed)
2
select cast(variance(ff) as decimal(10,3)) from t2;
cast(variance(ff) as decimal(10,3))
0.000
select cast(min(ff) as decimal(5,2)) from t2;
cast(min(ff) as decimal(5,2))
2.20
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select cast(sum(distinct df) as signed) from t1;
cast(sum(distinct df) as signed)
3
select cast(min(df) as signed) from t1;
cast(min(df) as signed)
0
select 1e8 * sum(distinct df) from t1;
1e8 * sum(distinct df)
330000000
select 1e8 * min(df) from t1;
1e8 * min(df)
110000000
create table t3 (ifl int);
insert into t3 values(1), (2);
select cast(min(ifl) as decimal(5,2)) from t3;
cast(min(ifl) as decimal(5,2))
1.00
drop table t1, t2, t3;
mysql-test/r/subselect.result
View file @
803ed1a1
...
@@ -2276,3 +2276,39 @@ pass userid parentid parentgroup childid groupname grouptypeid crse categoryid c
...
@@ -2276,3 +2276,39 @@ pass userid parentid parentgroup childid groupname grouptypeid crse categoryid c
1 5141 12 group2 12 group2 5 1 2 88 Oct04
1 5141 12 group2 12 group2 5 1 2 88 Oct04
1 5141 12 group2 12 group2 5 1 2 89 Oct04
1 5141 12 group2 12 group2 5 1 2 89 Oct04
drop table if exists t1, t2, t3, t4, t5;
drop table if exists t1, t2, t3, t4, t5;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 where df <= all (select avg(df) from t1 group by df);
df
1.1
select * from t1 where df >= all (select avg(df) from t1 group by df);
df
2.2
drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
select 1.1 * exists(select * from t1);
1.1 * exists(select * from t1)
1.1
drop table t1;
CREATE TABLE t1 (
grp int(11) default NULL,
a decimal(10,2) default NULL);
insert into t1 values (1, 1), (2, 2), (2, 3), (3, 4), (3, 5), (3, 6), (NULL, NULL);
select * from t1;
grp a
1 1.00
2 2.00
2 3.00
3 4.00
3 5.00
3 6.00
NULL NULL
select min(a) from t1 group by grp;
min(a)
NULL
1.00
2.00
4.00
drop table t1;
mysql-test/t/analyse.test
View file @
803ed1a1
...
@@ -47,3 +47,11 @@ create table t1 (v varchar(128));
...
@@ -47,3 +47,11 @@ create table t1 (v varchar(128));
insert
into
t1
values
(
'abc'
),(
'abc\'def\\hij\"klm\0opq'
),(
'\''
),(
'\"'
),(
'\\'
),(
'a\0'
),(
'b\''
),(
'c\"'
),(
'd\\'
),(
'\'b'
),(
'\"c'
),(
'\\d'
),(
'a\0\0\0b'
),(
'a\'\'\'\'b'
),(
'a\"\"\"\"b'
),(
'a\\\\\\\\b'
),(
'\'\0\\\"'
),(
'\'\''
),(
'\"\"'
),(
'\\\\'
),(
'The\ZEnd'
);
insert
into
t1
values
(
'abc'
),(
'abc\'def\\hij\"klm\0opq'
),(
'\''
),(
'\"'
),(
'\\'
),(
'a\0'
),(
'b\''
),(
'c\"'
),(
'd\\'
),(
'\'b'
),(
'\"c'
),(
'\\d'
),(
'a\0\0\0b'
),(
'a\'\'\'\'b'
),(
'a\"\"\"\"b'
),(
'a\\\\\\\\b'
),(
'\'\0\\\"'
),(
'\'\''
),(
'\"\"'
),(
'\\\\'
),(
'The\ZEnd'
);
select
*
from
t1
procedure
analyse
();
select
*
from
t1
procedure
analyse
();
drop
table
t1
;
drop
table
t1
;
#decimal-related test
create
table
t1
(
df
decimal
(
5
,
1
));
insert
into
t1
values
(
1.1
);
insert
into
t1
values
(
2.2
);
select
*
from
t1
procedure
analyse
();
drop
table
t1
;
mysql-test/t/cast.test
View file @
803ed1a1
...
@@ -118,3 +118,11 @@ select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
...
@@ -118,3 +118,11 @@ select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
select
timediff
(
cast
(
'2004-12-30 12:00:00'
as
time
),
'12:00:00'
);
select
timediff
(
cast
(
'2004-12-30 12:00:00'
as
time
),
'12:00:00'
);
# Still we should not throw away "days" part of time value
# Still we should not throw away "days" part of time value
select
timediff
(
cast
(
'1 12:00:00'
as
time
),
'12:00:00'
);
select
timediff
(
cast
(
'1 12:00:00'
as
time
),
'12:00:00'
);
#decimal-related additions
select
cast
(
'1.2'
as
decimal
(
3
,
2
));
select
1
e18
*
cast
(
'1.2'
as
decimal
(
3
,
2
));
select
cast
(
cast
(
'1.2'
as
decimal
(
3
,
2
))
as
signed
);
set
@
v1
=
1
e18
;
select
cast
(
@
v1
as
decimal
(
22
,
2
));
select
cast
(
-
1
e18
as
decimal
(
22
,
2
));
mysql-test/t/func_group.test
View file @
803ed1a1
...
@@ -492,3 +492,25 @@ drop table t2;
...
@@ -492,3 +492,25 @@ drop table t2;
create
table
t2
select
f2
from
(
select
now
()
f2
from
t1
)
a
;
create
table
t2
select
f2
from
(
select
now
()
f2
from
t1
)
a
;
show
columns
from
t2
;
show
columns
from
t2
;
drop
table
t2
,
t1
;
drop
table
t2
,
t1
;
# decimal-related tests
create
table
t2
(
ff
double
);
insert
into
t2
values
(
2.2
);
select
cast
(
sum
(
distinct
ff
)
as
decimal
(
5
,
2
))
from
t2
;
select
cast
(
sum
(
distinct
ff
)
as
signed
)
from
t2
;
select
cast
(
variance
(
ff
)
as
decimal
(
10
,
3
))
from
t2
;
select
cast
(
min
(
ff
)
as
decimal
(
5
,
2
))
from
t2
;
create
table
t1
(
df
decimal
(
5
,
1
));
insert
into
t1
values
(
1.1
);
insert
into
t1
values
(
2.2
);
select
cast
(
sum
(
distinct
df
)
as
signed
)
from
t1
;
select
cast
(
min
(
df
)
as
signed
)
from
t1
;
select
1
e8
*
sum
(
distinct
df
)
from
t1
;
select
1
e8
*
min
(
df
)
from
t1
;
create
table
t3
(
ifl
int
);
insert
into
t3
values
(
1
),
(
2
);
select
cast
(
min
(
ifl
)
as
decimal
(
5
,
2
))
from
t3
;
drop
table
t1
,
t2
,
t3
;
mysql-test/t/subselect.test
View file @
803ed1a1
...
@@ -1543,3 +1543,26 @@ group by
...
@@ -1543,3 +1543,26 @@ group by
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
t5
;
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
t5
;
#decimal-related tests
create
table
t1
(
df
decimal
(
5
,
1
));
insert
into
t1
values
(
1.1
);
insert
into
t1
values
(
2.2
);
select
*
from
t1
where
df
<=
all
(
select
avg
(
df
)
from
t1
group
by
df
);
select
*
from
t1
where
df
>=
all
(
select
avg
(
df
)
from
t1
group
by
df
);
drop
table
t1
;
create
table
t1
(
df
decimal
(
5
,
1
));
insert
into
t1
values
(
1.1
);
select
1.1
*
exists
(
select
*
from
t1
);
drop
table
t1
;
CREATE
TABLE
t1
(
grp
int
(
11
)
default
NULL
,
a
decimal
(
10
,
2
)
default
NULL
);
insert
into
t1
values
(
1
,
1
),
(
2
,
2
),
(
2
,
3
),
(
3
,
4
),
(
3
,
5
),
(
3
,
6
),
(
NULL
,
NULL
);
select
*
from
t1
;
select
min
(
a
)
from
t1
group
by
grp
;
drop
table
t1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment