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
d2e6c462
Commit
d2e6c462
authored
Apr 09, 2009
by
Sergey Glukhov
Browse files
Options
Browse Files
Download
Plain Diff
5.0-bugteam->5.1-bugteam merge
parents
53f89223
920abd58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
mysql-test/r/insert.result
mysql-test/r/insert.result
+5
-0
mysql-test/t/insert.test
mysql-test/t/insert.test
+9
-0
sql/field.cc
sql/field.cc
+3
-3
No files found.
mysql-test/r/insert.result
View file @
d2e6c462
...
...
@@ -633,4 +633,9 @@ SELECT * FROM t2;
c1
15449237462
DROP TABLE t1, t2;
CREATE TABLE t1(f1 FLOAT);
INSERT INTO t1 VALUES (1.23);
CREATE TABLE t2(f1 CHAR(1));
INSERT INTO t2 SELECT f1 FROM t1;
DROP TABLE t1, t2;
End of 5.0 tests.
mysql-test/t/insert.test
View file @
d2e6c462
...
...
@@ -488,5 +488,14 @@ SELECT * FROM t2;
DROP
TABLE
t1
,
t2
;
#
# Bug#43833 Simple INSERT crashes the server
#
CREATE
TABLE
t1
(
f1
FLOAT
);
INSERT
INTO
t1
VALUES
(
1.23
);
CREATE
TABLE
t2
(
f1
CHAR
(
1
));
INSERT
INTO
t2
SELECT
f1
FROM
t1
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.0
tests
.
sql/field.cc
View file @
d2e6c462
...
...
@@ -6448,13 +6448,13 @@ int Field_str::store(double nr)
calculate the maximum number of significant digits if the 'f'-format
would be used (+1 for decimal point if the number has a fractional part).
*/
digits
=
max
(
0
,
(
int
)
max_length
-
fractional
);
digits
=
max
(
1
,
(
int
)
max_length
-
fractional
);
/*
If the exponent is negative, decrease digits by the number of leading zeros
after the decimal point that do not count as significant digits.
*/
if
(
exp
<
0
)
digits
=
max
(
0
,
(
int
)
digits
+
exp
);
digits
=
max
(
1
,
(
int
)
digits
+
exp
);
/*
'e'-format is used only if the exponent is less than -4 or greater than or
equal to the precision. In this case we need to adjust the number of
...
...
@@ -6462,7 +6462,7 @@ int Field_str::store(double nr)
We also have to reserve one additional character if abs(exp) >= 100.
*/
if
(
exp
>=
(
int
)
digits
||
exp
<
-
4
)
digits
=
max
(
0
,
(
int
)
(
max_length
-
5
-
(
exp
>=
100
||
exp
<=
-
100
)));
digits
=
max
(
1
,
(
int
)
(
max_length
-
5
-
(
exp
>=
100
||
exp
<=
-
100
)));
/* Limit precision to DBL_DIG to avoid garbage past significant digits */
set_if_smaller
(
digits
,
DBL_DIG
);
...
...
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