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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b37a5f0f
Commit
b37a5f0f
authored
Nov 29, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.0
into mysql.com:/usr/local/mysql/mysql-5.0
parents
2985bc7a
c6f9e7bf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
96 deletions
+66
-96
mysql-test/r/type_newdecimal-big.result
mysql-test/r/type_newdecimal-big.result
+11
-0
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+0
-56
mysql-test/t/type_newdecimal-big.test
mysql-test/t/type_newdecimal-big.test
+31
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+24
-40
No files found.
mysql-test/r/type_newdecimal-big.result
0 → 100644
View file @
b37a5f0f
drop procedure if exists sp1;
create procedure sp1 () begin
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0;
while v5 < 100000 do
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
call sp1()//
v1 v2 v3 * 0.000000000001 v4 * 0.000000000001
1.000000100000 1.999999900000 1.000000100000 1.999999900000
drop procedure sp1;
mysql-test/r/type_newdecimal.result
View file @
b37a5f0f
...
...
@@ -678,16 +678,6 @@ select -18.3=18.3;
select 0.8 = 0.7 + 0.1;
0.8 = 0.7 + 0.1
1
create procedure p1 () begin
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0;
while v5 < 100000 do
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
call p1()//
v1 v2 v3 * 0.000000000001 v4 * 0.000000000001
1.000000100000 1.999999900000 1.000000100000 1.999999900000
drop procedure p1;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
...
...
@@ -1267,34 +1257,6 @@ CAST(my_varchar AS DECIMAL(65,30)) my_varchar
0.011754943450000000000000000000 1.175494345e-2
0.117549434500000000000000000000 1.175494345e-1
UPDATE t1 SET my_decimal = my_float;
Warnings:
Note 1265 Data truncated for column 'my_decimal' at row 1
Note 1265 Data truncated for column 'my_decimal' at row 2
Note 1265 Data truncated for column 'my_decimal' at row 3
Note 1265 Data truncated for column 'my_decimal' at row 4
Note 1265 Data truncated for column 'my_decimal' at row 5
Note 1265 Data truncated for column 'my_decimal' at row 6
Note 1265 Data truncated for column 'my_decimal' at row 7
Note 1265 Data truncated for column 'my_decimal' at row 8
Note 1265 Data truncated for column 'my_decimal' at row 9
Note 1265 Data truncated for column 'my_decimal' at row 10
Note 1265 Data truncated for column 'my_decimal' at row 11
Note 1265 Data truncated for column 'my_decimal' at row 12
Note 1265 Data truncated for column 'my_decimal' at row 13
Note 1265 Data truncated for column 'my_decimal' at row 14
Note 1265 Data truncated for column 'my_decimal' at row 15
Note 1265 Data truncated for column 'my_decimal' at row 16
Note 1265 Data truncated for column 'my_decimal' at row 17
Note 1265 Data truncated for column 'my_decimal' at row 19
Note 1265 Data truncated for column 'my_decimal' at row 20
Note 1265 Data truncated for column 'my_decimal' at row 21
Note 1265 Data truncated for column 'my_decimal' at row 22
Note 1265 Data truncated for column 'my_decimal' at row 23
Note 1265 Data truncated for column 'my_decimal' at row 26
Note 1265 Data truncated for column 'my_decimal' at row 27
Note 1265 Data truncated for column 'my_decimal' at row 30
Note 1265 Data truncated for column 'my_decimal' at row 31
Note 1265 Data truncated for column 'my_decimal' at row 32
SELECT my_decimal, my_float FROM t1;
my_decimal my_float
0.000000000000000000000000000000 1.17549e-32
...
...
@@ -1330,24 +1292,6 @@ my_decimal my_float
0.011754943057894710000000000000 0.0117549
0.117549434304237400000000000000 0.117549
UPDATE t1 SET my_decimal = my_double;
Warnings:
Note 1265 Data truncated for column 'my_decimal' at row 1
Note 1265 Data truncated for column 'my_decimal' at row 2
Note 1265 Data truncated for column 'my_decimal' at row 3
Note 1265 Data truncated for column 'my_decimal' at row 4
Note 1265 Data truncated for column 'my_decimal' at row 5
Note 1265 Data truncated for column 'my_decimal' at row 6
Note 1265 Data truncated for column 'my_decimal' at row 7
Note 1265 Data truncated for column 'my_decimal' at row 8
Note 1265 Data truncated for column 'my_decimal' at row 9
Note 1265 Data truncated for column 'my_decimal' at row 10
Note 1265 Data truncated for column 'my_decimal' at row 11
Note 1265 Data truncated for column 'my_decimal' at row 13
Note 1265 Data truncated for column 'my_decimal' at row 14
Note 1265 Data truncated for column 'my_decimal' at row 16
Note 1265 Data truncated for column 'my_decimal' at row 18
Note 1265 Data truncated for column 'my_decimal' at row 20
Note 1265 Data truncated for column 'my_decimal' at row 31
SELECT my_decimal, my_double FROM t1;
my_decimal my_double
0.000000000000000000000000000000 1.175494345e-32
...
...
mysql-test/t/type_newdecimal-big.test
0 → 100644
View file @
b37a5f0f
--
source
include
/
big_test
.
inc
--
disable_warnings
drop
procedure
if
exists
sp1
;
--
enable_warnings
#
#-- 2. Adding (one millionth) one million times should be the same as
#-- adding 1. So a stored procedure with many iterations will show if
#-- small errors accumulate.
#
delimiter
//;
#
create
procedure
sp1
()
begin
declare
v1
,
v2
,
v3
,
v4
decimal
(
16
,
12
);
declare
v5
int
;
set
v1
=
1
;
set
v2
=
2
;
set
v3
=
1000000000000
;
set
v4
=
2000000000000
;
set
v5
=
0
;
while
v5
<
100000
do
set
v1
=
v1
+
0.000000000001
;
set
v2
=
v2
-
0.000000000001
;
set
v3
=
v3
+
1
;
set
v4
=
v4
-
1
;
set
v5
=
v5
+
1
;
end
while
;
select
v1
,
v2
,
v3
*
0.000000000001
,
v4
*
0.000000000001
;
end
;
//
#
call
sp1
()
//
#-- should return
# -- v1=1.0000001
# -- v2=1.999999900000
# -- v3=1.0000001
# -- v4=1.999999900000
#
delimiter
;
//
#
drop
procedure
sp1
;
mysql-test/t/type_newdecimal.test
View file @
b37a5f0f
...
...
@@ -473,7 +473,7 @@ drop table wl1612_4;
#
#-- Additional tests for WL#1612 Precision math
#
#--
1.
Comparisons should show that a number is
#-- Comparisons should show that a number is
#-- exactly equal to its value as displayed.
#
set
sql_mode
=
''
;
...
...
@@ -487,34 +487,9 @@ select 18.3=18.3;
select
-
18.3
=
18.3
;
#
select
0.8
=
0.7
+
0.1
;
#
#-- 2. Adding (one millionth) one million times should be the same as
#-- adding 1. So a stored procedure with many iterations will show if
#-- small errors accumulate.
#
#drop procedure p1;
#
delimiter
//;
#
create
procedure
p1
()
begin
declare
v1
,
v2
,
v3
,
v4
decimal
(
16
,
12
);
declare
v5
int
;
set
v1
=
1
;
set
v2
=
2
;
set
v3
=
1000000000000
;
set
v4
=
2000000000000
;
set
v5
=
0
;
while
v5
<
100000
do
set
v1
=
v1
+
0.000000000001
;
set
v2
=
v2
-
0.000000000001
;
set
v3
=
v3
+
1
;
set
v4
=
v4
-
1
;
set
v5
=
v5
+
1
;
end
while
;
select
v1
,
v2
,
v3
*
0.000000000001
,
v4
*
0.000000000001
;
end
;
//
#
call
p1
()
//
#-- should return
# -- v1=1.0000001
# -- v2=1.999999900000
# -- v3=1.0000001
# -- v4=1.999999900000
#
delimiter
;
//
#
drop
procedure
p1
;
#
#-- 3. It should be possible to define a column
#-- It should be possible to define a column
#-- with up to 38 digits precision either before
#-- or after the decimal point. Any number which
#-- is inserted, if it's within the range, should
...
...
@@ -565,7 +540,7 @@ select * from t1;
#
drop
table
t1
;
#
#--
4.
The usual arithmetic operators / * + - should work.
#-- The usual arithmetic operators / * + - should work.
#
#select 77777777777777777777777777777777777777 / 7777777777777777777777777777777777777 = 10;
#-- should return 0 (false).
...
...
@@ -668,7 +643,7 @@ select truncate(99999999999999999999999999999999999999,-31);
#drop procedure p1;
#drop table t1;
#
#--
7.
When I say DECIMAL(x) I should be able to store x digits.
#-- When I say DECIMAL(x) I should be able to store x digits.
#-- If I can't, there should be an error at CREATE time.
#
#drop table if exists t1;
...
...
@@ -676,7 +651,8 @@ select truncate(99999999999999999999999999999999999999,-31);
#create table t1 (col1 decimal(254));
#-- should return SQLSTATE 22003 numeric value out of range
#
#-- 8. When I say DECIMAL(x,y) there should be no silent change of precision or scale.
#-- When I say DECIMAL(x,y) there should be no silent change of precision or
#-- scale.
#
#drop table if exists t1;
#
...
...
@@ -694,7 +670,7 @@ select truncate(99999999999999999999999999999999999999,-31);
#
#drop table t1;
#
#--
9.
From WL#1612 "The future" point 2.:
#-- From WL#1612 "The future" point 2.:
#-- The standard requires that we treat numbers like "0.5" as
#-- DECIMAL or NUMERIC, not as floating-point.
#
...
...
@@ -715,7 +691,7 @@ show create table t1;
#
drop
table
t1
;
#
#--
10.
From WL#1612, "The future", point 3.: We have to start rounding correctly.
#-- From WL#1612, "The future", point 3.: We have to start rounding correctly.
#
select
round
(
1.5
),
round
(
2.5
);
#-- should return:
...
...
@@ -725,13 +701,13 @@ select round(1.5),round(2.5);
#| 2 | 3 |
#+------------+------------+
#
#--
11.
From WL#1612, "The future", point 4.: "select 0.07 * 0.07;" should return 0.0049, not 0.00.
#-- From WL#1612, "The future", point 4.: "select 0.07 * 0.07;" should return 0.0049, not 0.00.
#-- If operand#1 has scale X and operand#2 has scale Y, then result should have scale (X+Y).
#
select
0.07
*
0.07
;
#-- should return 0.0049
#
#--
12.
From WL#1612, "The future", point 5.: Division by zero is an error.
#-- From WL#1612, "The future", point 5.: Division by zero is an error.
#
set
sql_mode
=
'traditional'
;
#
...
...
@@ -752,7 +728,7 @@ select 1 / 0;
#+-------+
#1 row in set, 1 warning (0.00 sec)
#
#--
13.
From WL#1612 "The future" point 6.: Overflow is an error.
#-- From WL#1612 "The future" point 6.: Overflow is an error.
#
#set sql_mode='';
#
...
...
@@ -793,7 +769,8 @@ select 1 / 0;
#drop table t2;
#drop table t1;
#
#-- 15. From WL#1612 "The future" point 8.: Stop storing leading "+" signs and leading "0"s.
#-- From WL#1612 "The future" point 8.: Stop storing leading "+" signs and
# leading "0"s.
#
#drop table if exists t1;
#
...
...
@@ -805,7 +782,7 @@ select 1 / 0;
#
#drop table t1;
#
#--
16.
From WL#1612, The future" point 9.:
#-- From WL#1612, The future" point 9.:
#-- Accept the data type and precision and scale as the user
#-- asks, or return an error, but don't change to something else.
#
...
...
@@ -817,7 +794,7 @@ select 1 / 0;
#
#drop table t1;
#
#--
17.
The scripts in the following bugs should work:
#-- The scripts in the following bugs should work:
#
#BUG#559 Maximum precision for DECIMAL column ...
...
...
@@ -833,7 +810,7 @@ select 1 / 0;
#BUG#6048 Stored procedure causes operating system reboot
#BUG#6053 DOUBLE PRECISION literal
--
18.
Tests
from
'traditional'
mode
tests
--
Tests
from
'traditional'
mode
tests
#
set
sql_mode
=
'ansi,traditional'
;
#
...
...
@@ -1077,10 +1054,17 @@ SELECT CAST(my_float AS DECIMAL(65,30)), my_float FROM t1;
SELECT
CAST
(
my_double
AS
DECIMAL
(
65
,
30
)),
my_double
FROM
t1
;
SELECT
CAST
(
my_varchar
AS
DECIMAL
(
65
,
30
)),
my_varchar
FROM
t1
;
# We have to disable warnings here as the test in
# Field_new_decimal::store(double):
# if (nr2 != nr)
# fails randomly depending on compiler options
--
disable_warnings
UPDATE
t1
SET
my_decimal
=
my_float
;
SELECT
my_decimal
,
my_float
FROM
t1
;
UPDATE
t1
SET
my_decimal
=
my_double
;
SELECT
my_decimal
,
my_double
FROM
t1
;
--
enable_warnings
UPDATE
t1
SET
my_decimal
=
my_varchar
;
SELECT
my_decimal
,
my_varchar
FROM
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