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
aa991c6f
Commit
aa991c6f
authored
Aug 25, 2005
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #12694 (float(1,2) field error)
parent
adb82441
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
mysql-test/t/type_float.test
mysql-test/t/type_float.test
+9
-0
sql/sql_parse.cc
sql/sql_parse.cc
+14
-2
No files found.
mysql-test/t/type_float.test
View file @
aa991c6f
...
@@ -147,3 +147,12 @@ select * from t1 where reckey=1.09E2;
...
@@ -147,3 +147,12 @@ select * from t1 where reckey=1.09E2;
drop
table
t1
;
drop
table
t1
;
# End of 4.1 tests
# End of 4.1 tests
#
# bug #12694 (float(m,d) specifications)
#
--
error
1427
create
table
t1
(
s1
float
(
0
,
2
));
--
error
1427
create
table
t1
(
s1
float
(
1
,
2
));
sql/sql_parse.cc
View file @
aa991c6f
...
@@ -5752,19 +5752,31 @@ new_create_field(THD *thd, char *field_name, enum_field_types type,
...
@@ -5752,19 +5752,31 @@ new_create_field(THD *thd, char *field_name, enum_field_types type,
new_field
->
decimals
=
NOT_FIXED_DEC
;
new_field
->
decimals
=
NOT_FIXED_DEC
;
break
;
break
;
}
}
if
(
!
length
)
if
(
!
length
&&
!
decimals
)
{
{
new_field
->
length
=
FLT_DIG
+
6
;
new_field
->
length
=
FLT_DIG
+
6
;
new_field
->
decimals
=
NOT_FIXED_DEC
;
new_field
->
decimals
=
NOT_FIXED_DEC
;
}
}
if
(
new_field
->
length
<
new_field
->
decimals
&&
new_field
->
decimals
!=
NOT_FIXED_DEC
)
{
my_error
(
ER_SCALE_BIGGER_THAN_PRECISION
,
MYF
(
0
),
field_name
);
DBUG_RETURN
(
NULL
);
}
break
;
break
;
case
FIELD_TYPE_DOUBLE
:
case
FIELD_TYPE_DOUBLE
:
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
if
(
!
length
)
if
(
!
length
&&
!
decimals
)
{
{
new_field
->
length
=
DBL_DIG
+
7
;
new_field
->
length
=
DBL_DIG
+
7
;
new_field
->
decimals
=
NOT_FIXED_DEC
;
new_field
->
decimals
=
NOT_FIXED_DEC
;
}
}
if
(
new_field
->
length
<
new_field
->
decimals
&&
new_field
->
decimals
!=
NOT_FIXED_DEC
)
{
my_error
(
ER_SCALE_BIGGER_THAN_PRECISION
,
MYF
(
0
),
field_name
);
DBUG_RETURN
(
NULL
);
}
break
;
break
;
case
FIELD_TYPE_TIMESTAMP
:
case
FIELD_TYPE_TIMESTAMP
:
if
(
!
length
)
if
(
!
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