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
d89d12e3
Commit
d89d12e3
authored
Dec 26, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
parent
812bb130
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
7 deletions
+95
-7
mysql-test/main/func_hybrid_type.result
mysql-test/main/func_hybrid_type.result
+18
-0
mysql-test/main/func_hybrid_type.test
mysql-test/main/func_hybrid_type.test
+16
-0
mysql-test/main/func_math.result
mysql-test/main/func_math.result
+33
-0
mysql-test/main/func_math.test
mysql-test/main/func_math.test
+25
-0
sql/item_func.cc
sql/item_func.cc
+3
-7
No files found.
mysql-test/main/func_hybrid_type.result
View file @
d89d12e3
...
...
@@ -3753,5 +3753,23 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
#
SET sql_mode='';
CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED);
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 AS SELECT
IFNULL(SLEEP(0.01), NULL DIV d) AS f0,
IFNULL(SLEEP(0.01), '' DIV d) AS f1
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`f0` decimal(1,0) DEFAULT NULL,
`f1` decimal(1,0) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
SET sql_mode=DEFAULT;
#
# End of 10.3 tests
#
mysql-test/main/func_hybrid_type.test
View file @
d89d12e3
...
...
@@ -611,6 +611,22 @@ CREATE TABLE t1 AS SELECT
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
--
echo
#
SET
sql_mode
=
''
;
CREATE
TABLE
t1
(
d
DECIMAL
(
43
,
0
)
UNSIGNED
);
INSERT
INTO
t1
VALUES
(
1
);
CREATE
TABLE
t2
AS
SELECT
IFNULL
(
SLEEP
(
0.01
),
NULL
DIV
d
)
AS
f0
,
IFNULL
(
SLEEP
(
0.01
),
''
DIV
d
)
AS
f1
FROM
t1
;
SHOW
CREATE
TABLE
t2
;
DROP
TABLE
t1
,
t2
;
SET
sql_mode
=
DEFAULT
;
--
echo
#
--
echo
# End of 10.3 tests
--
echo
#
...
...
mysql-test/main/func_math.result
View file @
d89d12e3
...
...
@@ -1285,3 +1285,36 @@ E59B9BE4BA94E585AD 2914501801
E4B883E585ABE4B99D 2374586519
DROP TABLE t1;
SET NAMES default;
#
# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
#
SET sql_mode='';
CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED);
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 AS SELECT
NULL DIV d AS d_null,
'' DIV d AS d_empty_string,
X'32' DIV d AS d_hex_string2,
X'3232' DIV d AS d_hex_string4,
TIME(0) DIV d AS d_time,
CURRENT_DATE DIV d AS d_date,
CURRENT_TIMESTAMP DIV d AS d_datetime
FROM t1;
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ''
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`d_null` int(1) unsigned DEFAULT NULL,
`d_empty_string` int(1) unsigned DEFAULT NULL,
`d_hex_string2` int(1) unsigned DEFAULT NULL,
`d_hex_string4` int(2) unsigned DEFAULT NULL,
`d_time` int(7) unsigned DEFAULT NULL,
`d_date` int(8) unsigned DEFAULT NULL,
`d_datetime` bigint(14) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
SET sql_mode=DEFAULT;
#
# End of 10.3 tests
#
mysql-test/main/func_math.test
View file @
d89d12e3
...
...
@@ -897,3 +897,28 @@ LOAD DATA INFILE '../../std_data/loaddata_utf8.dat' INTO TABLE t1 CHARACTER SET
SELECT
HEX
(
a
),
CRC32
(
a
)
from
t1
;
DROP
TABLE
t1
;
SET
NAMES
default
;
--
echo
#
--
echo
# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
--
echo
#
SET
sql_mode
=
''
;
CREATE
TABLE
t1
(
d
DECIMAL
(
43
,
0
)
UNSIGNED
);
INSERT
INTO
t1
VALUES
(
1
);
CREATE
TABLE
t2
AS
SELECT
NULL
DIV
d
AS
d_null
,
''
DIV
d
AS
d_empty_string
,
X
'32'
DIV
d
AS
d_hex_string2
,
X
'3232'
DIV
d
AS
d_hex_string4
,
TIME
(
0
)
DIV
d
AS
d_time
,
CURRENT_DATE
DIV
d
AS
d_date
,
CURRENT_TIMESTAMP
DIV
d
AS
d_datetime
FROM
t1
;
SHOW
CREATE
TABLE
t2
;
DROP
TABLE
t1
,
t2
;
SET
sql_mode
=
DEFAULT
;
--
echo
#
--
echo
# End of 10.3 tests
--
echo
#
sql/item_func.cc
View file @
d89d12e3
...
...
@@ -1752,13 +1752,9 @@ longlong Item_func_int_div::val_int()
bool
Item_func_int_div
::
fix_length_and_dec
()
{
Item_result
argtype
=
args
[
0
]
->
result_type
();
/* use precision ony for the data type it is applicable for and valid */
uint32
char_length
=
args
[
0
]
->
max_char_length
()
-
(
argtype
==
DECIMAL_RESULT
||
argtype
==
INT_RESULT
?
args
[
0
]
->
decimals
:
0
);
fix_char_length
(
char_length
>
MY_INT64_NUM_DECIMAL_DIGITS
?
MY_INT64_NUM_DECIMAL_DIGITS
:
char_length
);
uint32
prec
=
args
[
0
]
->
decimal_int_part
();
set_if_smaller
(
prec
,
MY_INT64_NUM_DECIMAL_DIGITS
);
fix_char_length
(
prec
);
maybe_null
=
1
;
unsigned_flag
=
args
[
0
]
->
unsigned_flag
|
args
[
1
]
->
unsigned_flag
;
return
false
;
...
...
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