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
29b8e097
Commit
29b8e097
authored
Mar 28, 2006
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/home/bar/mysql-4.1.b15098
into mysql.com:/usr/home/bar/mysql-5.0 Bug#15098
parents
37a6167d
3e284e22
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
mysql-test/r/cast.result
mysql-test/r/cast.result
+8
-0
mysql-test/t/cast.test
mysql-test/t/cast.test
+9
-0
sql/field.cc
sql/field.cc
+5
-0
No files found.
mysql-test/r/cast.result
View file @
29b8e097
...
...
@@ -370,3 +370,11 @@ DROP TABLE t1;
select cast(NULL as decimal(6)) as t1;
t1
NULL
CREATE TABLE t1 (f1 double);
INSERT INTO t1 SET f1 = -1.0e+30 ;
INSERT INTO t1 SET f1 = +1.0e+30 ;
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
double_val cast_val
-1e+30 -9223372036854775808
1e+30 9223372036854775807
DROP TABLE t1;
mysql-test/t/cast.test
View file @
29b8e097
...
...
@@ -165,6 +165,15 @@ select cast(repeat('1',20) as signed);
#
select
cast
(
1.0e+300
as
signed
int
);
#
# Bugs: #15098: CAST(column double TO signed int), wrong result
#
CREATE
TABLE
t1
(
f1
double
);
INSERT
INTO
t1
SET
f1
=
-
1.0e+30
;
INSERT
INTO
t1
SET
f1
=
+
1.0e+30
;
SELECT
f1
AS
double_val
,
CAST
(
f1
AS
SIGNED
INT
)
AS
cast_val
FROM
t1
;
DROP
TABLE
t1
;
# End of 4.1 tests
...
...
sql/field.cc
View file @
29b8e097
...
...
@@ -4240,6 +4240,11 @@ longlong Field_double::val_int(void)
else
#endif
doubleget
(
j
,
ptr
);
/* Check whether we fit into longlong range */
if
(
j
<=
(
double
)
LONGLONG_MIN
)
return
(
longlong
)
LONGLONG_MIN
;
if
(
j
>=
(
double
)
(
ulonglong
)
LONGLONG_MAX
)
return
(
longlong
)
LONGLONG_MAX
;
return
(
longlong
)
rint
(
j
);
}
...
...
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