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
1be93531
Commit
1be93531
authored
Aug 08, 2006
by
gluh@mysql.com/gluh.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#16172 DECIMAL data type processed incorrectly
issue an error in case of DECIMAL(M,N) if N > M
parent
e9b87a1a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
4 deletions
+23
-4
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+5
-1
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+6
-2
sql/item_create.cc
sql/item_create.cc
+8
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+4
-0
No files found.
mysql-test/r/type_newdecimal.result
View file @
1be93531
...
...
@@ -915,9 +915,13 @@ drop table t1;
select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15));
cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15))
0.000000000100000
select ln(14000) c1, convert(ln(14000),decimal(
2,3)) c2, cast(ln(14000) as decimal(2
,3)) c3;
select ln(14000) c1, convert(ln(14000),decimal(
5,3)) c2, cast(ln(14000) as decimal(5
,3)) c3;
c1 c2 c3
9.5468126085974 9.547 9.547
select convert(ln(14000),decimal(2,3)) c1;
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
select cast(ln(14000) as decimal(2,3)) c1;
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
create table t1 (sl decimal(70,30));
ERROR 42000: Too big precision 70 specified for column 'sl'. Maximum is 65.
create table t1 (sl decimal(32,31));
...
...
mysql-test/t/type_newdecimal.test
View file @
1be93531
...
...
@@ -947,8 +947,12 @@ select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(3
#
# Bug #11708 (conversion to decimal fails in decimal part)
#
select
ln
(
14000
)
c1
,
convert
(
ln
(
14000
),
decimal
(
2
,
3
))
c2
,
cast
(
ln
(
14000
)
as
decimal
(
2
,
3
))
c3
;
select
ln
(
14000
)
c1
,
convert
(
ln
(
14000
),
decimal
(
5
,
3
))
c2
,
cast
(
ln
(
14000
)
as
decimal
(
5
,
3
))
c3
;
--
error
1427
select
convert
(
ln
(
14000
),
decimal
(
2
,
3
))
c1
;
--
error
1427
select
cast
(
ln
(
14000
)
as
decimal
(
2
,
3
))
c1
;
#
# Bug #8449 (Silent column changes)
#
...
...
sql/item_create.cc
View file @
1be93531
...
...
@@ -450,6 +450,7 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec,
CHARSET_INFO
*
cs
)
{
Item
*
res
;
int
tmp_len
;
LINT_INIT
(
res
);
switch
(
cast_type
)
{
...
...
@@ -460,7 +461,13 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec,
case
ITEM_CAST_TIME
:
res
=
new
Item_time_typecast
(
a
);
break
;
case
ITEM_CAST_DATETIME
:
res
=
new
Item_datetime_typecast
(
a
);
break
;
case
ITEM_CAST_DECIMAL
:
res
=
new
Item_decimal_typecast
(
a
,
(
len
>
0
)
?
len
:
10
,
dec
?
dec
:
2
);
tmp_len
=
(
len
>
0
)
?
len
:
10
;
if
(
tmp_len
<
dec
)
{
my_error
(
ER_M_BIGGER_THAN_D
,
MYF
(
0
),
""
);
return
0
;
}
res
=
new
Item_decimal_typecast
(
a
,
tmp_len
,
dec
?
dec
:
2
);
break
;
case
ITEM_CAST_CHAR
:
res
=
new
Item_char_typecast
(
a
,
len
,
cs
?
cs
:
...
...
sql/sql_yacc.yy
View file @
1be93531
...
...
@@ -4359,6 +4359,8 @@ simple_expr:
lex->length ? atoi(lex->length) : -1,
lex->dec ? atoi(lex->dec) : 0,
lex->charset);
if (!$$)
YYABORT;
}
| CASE_SYM opt_expr WHEN_SYM when_list opt_else END
{ $$= new Item_func_case(* $4, $2, $5 ); }
...
...
@@ -4368,6 +4370,8 @@ simple_expr:
Lex->length ? atoi(Lex->length) : -1,
Lex->dec ? atoi(Lex->dec) : 0,
Lex->charset);
if (!$$)
YYABORT;
}
| CONVERT_SYM '(' expr USING charset_name ')'
{ $$= new Item_func_conv_charset($3,$5); }
...
...
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