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
b81af1c7
Commit
b81af1c7
authored
Aug 19, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
less strict assert to take into account weird cases
parent
dd3db08b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
mysql-test/r/type_float.result
mysql-test/r/type_float.result
+3
-0
mysql-test/t/type_float.test
mysql-test/t/type_float.test
+7
-0
sql/field.cc
sql/field.cc
+4
-2
No files found.
mysql-test/r/type_float.result
View file @
b81af1c7
...
...
@@ -114,6 +114,9 @@ select min(a) from t1;
min(a)
-0.010
drop table t1;
create table t1 (c20 char);
insert into t1 (c20) values (5000.0);
drop table t1;
create table t1 (f float(54));
Incorrect column specifier for column 'f'
drop table if exists t1;
mysql-test/t/type_float.test
View file @
b81af1c7
...
...
@@ -54,6 +54,13 @@ select a from t1 order by a;
select
min
(
a
)
from
t1
;
drop
table
t1
;
#
# float in a char(1) field
#
create
table
t1
(
c20
char
);
insert
into
t1
(
c20
)
values
(
5000.0
);
drop
table
t1
;
# Errors
--
error
1063
...
...
sql/field.cc
View file @
b81af1c7
...
...
@@ -3733,15 +3733,17 @@ static void store_double_in_string_field(Field_str *field, uint32 field_length,
use_scientific_notation
=
(
field
->
ceiling
<
nr
);
}
length
=
(
uint
)
sprintf
(
buff
,
"%-.*g"
,
use_scientific_notation
?
max
(
0
,
field_length
-
5
)
:
field_length
,
use_scientific_notation
?
max
(
0
,
(
int
)
field_length
-
5
)
:
field_length
,
nr
);
/*
+1 below is because "precision" in %g above means the
max. number of significant digits, not the output width.
Thus the width can be larger than number of significant digits by 1
(for decimal point)
the test for field_length < 5 is for extreme cases,
like inserting 500.0 in char(1)
*/
DBUG_ASSERT
(
length
<=
field_length
+
1
);
DBUG_ASSERT
(
field_length
<
5
||
length
<=
field_length
+
1
);
field
->
store
(
buff
,
min
(
length
,
field_length
));
}
...
...
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