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
dcb7b452
Commit
dcb7b452
authored
May 14, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in CREATE ... DECIMAL(-1,1). Bug #432
parent
d8a6c1ca
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
8 deletions
+27
-8
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+2
-1
mysql-test/r/type_decimal.result
mysql-test/r/type_decimal.result
+6
-0
mysql-test/t/type_decimal.test
mysql-test/t/type_decimal.test
+10
-0
sql/sql_parse.cc
sql/sql_parse.cc
+9
-7
No files found.
mysql-test/mysql-test-run.sh
View file @
dcb7b452
...
@@ -114,6 +114,7 @@ if test $? != 0; then exit 1; fi
...
@@ -114,6 +114,7 @@ if test $? != 0; then exit 1; fi
TR
=
tr
TR
=
tr
XARGS
=
`
which xargs
`
XARGS
=
`
which xargs
`
if
test
$?
!=
0
;
then
exit
1
;
fi
if
test
$?
!=
0
;
then
exit
1
;
fi
SORT
=
sort
# Are we using a source or a binary distribution?
# Are we using a source or a binary distribution?
...
@@ -1363,7 +1364,7 @@ then
...
@@ -1363,7 +1364,7 @@ then
if
[
x
$RECORD
=
x1
]
;
then
if
[
x
$RECORD
=
x1
]
;
then
$ECHO
"Will not run in record mode without a specific test case."
$ECHO
"Will not run in record mode without a specific test case."
else
else
for
tf
in
$TESTDIR
/
*
.
$TESTSUFFIX
for
tf
in
`
ls
-1
$TESTDIR
/
*
.
$TESTSUFFIX
|
$SORT
`
do
do
run_testcase
$tf
run_testcase
$tf
done
done
...
...
mysql-test/r/type_decimal.result
View file @
dcb7b452
...
@@ -357,3 +357,9 @@ select * from t1;
...
@@ -357,3 +357,9 @@ select * from t1;
a
a
99999999999
99999999999
drop table t1;
drop table t1;
CREATE TABLE t1 (a_dec DECIMAL(-1,0));
Too big column length for column 'a_dec' (max = 255). Use BLOB instead
CREATE TABLE t1 (a_dec DECIMAL(-2,1));
Too big column length for column 'a_dec' (max = 255). Use BLOB instead
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
Too big column length for column 'a_dec' (max = 255). Use BLOB instead
mysql-test/t/type_decimal.test
View file @
dcb7b452
...
@@ -230,3 +230,13 @@ insert into t1 values("1e4294967297");
...
@@ -230,3 +230,13 @@ insert into t1 values("1e4294967297");
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Test of wrong decimal type
#
--
error
1074
CREATE
TABLE
t1
(
a_dec
DECIMAL
(
-
1
,
0
));
--
error
1074
CREATE
TABLE
t1
(
a_dec
DECIMAL
(
-
2
,
1
));
--
error
1074
CREATE
TABLE
t1
(
a_dec
DECIMAL
(
-
1
,
1
));
sql/sql_parse.cc
View file @
dcb7b452
...
@@ -2977,8 +2977,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
...
@@ -2977,8 +2977,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
new_field
->
change
=
change
;
new_field
->
change
=
change
;
new_field
->
interval
=
0
;
new_field
->
interval
=
0
;
new_field
->
pack_length
=
0
;
new_field
->
pack_length
=
0
;
if
(
length
)
if
(
length
&&
!
(
new_field
->
length
=
(
uint
)
atoi
(
length
)))
if
(
!
(
new_field
->
length
=
(
uint
)
atoi
(
length
)))
length
=
0
;
/* purecov: inspected */
length
=
0
;
/* purecov: inspected */
uint
sign_len
=
type_modifier
&
UNSIGNED_FLAG
?
0
:
1
;
uint
sign_len
=
type_modifier
&
UNSIGNED_FLAG
?
0
:
1
;
...
@@ -3015,10 +3014,13 @@ bool add_field_to_list(char *field_name, enum_field_types type,
...
@@ -3015,10 +3014,13 @@ bool add_field_to_list(char *field_name, enum_field_types type,
break
;
break
;
case
FIELD_TYPE_DECIMAL
:
case
FIELD_TYPE_DECIMAL
:
if
(
!
length
)
if
(
!
length
)
new_field
->
length
=
10
;
// Default length for DECIMAL
new_field
->
length
=
10
;
// Default length for DECIMAL
if
(
new_field
->
length
<
MAX_FIELD_WIDTH
)
// Skip wrong argument
{
new_field
->
length
+=
sign_len
;
new_field
->
length
+=
sign_len
;
if
(
new_field
->
decimals
)
if
(
new_field
->
decimals
)
new_field
->
length
++
;
new_field
->
length
++
;
}
break
;
break
;
case
FIELD_TYPE_BLOB
:
case
FIELD_TYPE_BLOB
:
case
FIELD_TYPE_TINY_BLOB
:
case
FIELD_TYPE_TINY_BLOB
:
...
...
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