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
f827ba3b
Commit
f827ba3b
authored
May 14, 2020
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/10.1' into 10.2
parents
edbf1245
910c3192
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
768 additions
and
0 deletions
+768
-0
mysql-test/r/func_math.result
mysql-test/r/func_math.result
+718
-0
mysql-test/t/func_math.test
mysql-test/t/func_math.test
+47
-0
sql/item_func.cc
sql/item_func.cc
+3
-0
No files found.
mysql-test/r/func_math.result
View file @
f827ba3b
This diff is collapsed.
Click to expand it.
mysql-test/t/func_math.test
View file @
f827ba3b
...
...
@@ -716,6 +716,53 @@ SELECT -9223372036854775808 MOD 9223372036854775808;
SELECT
-
9223372036854775808
MOD
-
9223372036854775808
;
--
echo
#
--
echo
# MDEV-22503 MDB limits DECIMAL column precision to 16 doing CTAS with floor/ceil over DECIMAL(X,Y) where X > 16
--
echo
#
CREATE
TABLE
t44
(
d1
decimal
(
38
,
0
)
DEFAULT
NULL
);
INSERT
INTO
t44
VALUES
(
12345678901234567890123456789012345678
);
SELECT
FLOOR
(
d1
)
FROM
t44
;
CREATE
TABLE
t45
AS
SELECT
FLOOR
(
d1
)
FROM
t44
;
SELECT
*
FROM
t45
;
SHOW
CREATE
TABLE
t45
;
DROP
TABLE
t44
,
t45
;
DELIMITER
$$
;
CREATE
PROCEDURE
p1
(
prec
INT
,
scale
INT
)
BEGIN
DECLARE
maxval
VARCHAR
(
128
)
DEFAULT
''
;
SET
@
type
=
CONCAT
(
'DECIMAL('
,
prec
,
','
,
scale
,
')'
);
SET
@
stmt
=
CONCAT
(
'CREATE TABLE t1 (a '
,
@
type
,
',b '
,
@
type
,
'unsigned)'
);
PREPARE
stmt
FROM
@
stmt
;
EXECUTE
stmt
;
DEALLOCATE
PREPARE
stmt
;
SET
maxval
=
CONCAT
(
REPEAT
(
'9'
,
prec
-
scale
),
'.'
,
REPEAT
(
'9'
,
scale
));
INSERT
INTO
t1
VALUES
(
maxval
,
maxval
);
CREATE
TABLE
t2
AS
SELECT
a
,
b
,
FLOOR
(
a
)
AS
fa
,
FLOOR
(
b
)
AS
fb
FROM
t1
;
SHOW
CREATE
TABLE
t2
;
SELECT
*
FROM
t2
;
DROP
TABLE
t1
,
t2
;
END
;
$$
CREATE
PROCEDURE
p2
(
prec
INT
)
BEGIN
DECLARE
scale
INT
DEFAULT
0
;
WHILE
scale
<
prec
AND
scale
<=
30
DO
CALL
p1
(
prec
,
scale
);
SET
scale
=
scale
+
1
;
END
WHILE
;
END
;
$$
DELIMITER
;
$$
--
vertical_results
CALL
p2
(
38
);
CALL
p2
(
30
);
--
horizontal_results
DROP
PROCEDURE
p2
;
DROP
PROCEDURE
p1
;
--
echo
#
--
echo
# End of 10.1 tests
...
...
sql/item_func.cc
View file @
f827ba3b
...
...
@@ -2326,6 +2326,9 @@ bool Item_func_int_val::fix_length_and_dec()
if
((
args
[
0
]
->
max_length
-
args
[
0
]
->
decimals
)
>=
(
DECIMAL_LONGLONG_DIGITS
-
2
))
{
fix_char_length
(
my_decimal_precision_to_length_no_truncation
(
args
[
0
]
->
decimal_int_part
(),
0
,
false
));
set_handler_by_result_type
(
DECIMAL_RESULT
);
}
else
...
...
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