Commit 71eee693 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-9167: COLUMN_CHECK fails on valid decimal data

Check now allows zero length decimals too.

(backporting Adam Chainz patch to 10.0)
parent bd69d7b3
...@@ -1858,5 +1858,20 @@ SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET utf8), 1 AS CHAR ...@@ -1858,5 +1858,20 @@ SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET utf8), 1 AS CHAR
a a
¢ ¢
# #
# MDEV-9167: COLUMN_CHECK fails on valid decimal data
#
SELECT COLUMN_CHECK(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL));
COLUMN_CHECK(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL))
1
SELECT COLUMN_CHECK(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
COLUMN_CHECK(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL))
1
SELECT COLUMN_JSON(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL));
COLUMN_JSON(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL))
{"a":0,"b":1}
SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL))
{"a":1,"b":1}
#
# end of 10.0 tests # end of 10.0 tests
# #
...@@ -908,6 +908,18 @@ SET NAMES utf8; ...@@ -908,6 +908,18 @@ SET NAMES utf8;
SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET latin1), 1 AS CHAR CHARACTER SET utf8) AS a; SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET latin1), 1 AS CHAR CHARACTER SET utf8) AS a;
SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET utf8), 1 AS CHAR CHARACTER SET utf8) AS a; SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET utf8), 1 AS CHAR CHARACTER SET utf8) AS a;
--echo #
--echo # MDEV-9167: COLUMN_CHECK fails on valid decimal data
--echo #
SELECT COLUMN_CHECK(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_CHECK(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_JSON(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
--echo # --echo #
--echo # end of 10.0 tests --echo # end of 10.0 tests
--echo # --echo #
...@@ -3725,7 +3725,8 @@ mariadb_dyncol_check(DYNAMIC_COLUMN *str) ...@@ -3725,7 +3725,8 @@ mariadb_dyncol_check(DYNAMIC_COLUMN *str)
/* It is not first entry */ /* It is not first entry */
if (prev_data_offset > data_offset || if (prev_data_offset > data_offset ||
((prev_type != DYN_COL_INT && ((prev_type != DYN_COL_INT &&
prev_type != DYN_COL_UINT) && prev_data_offset == data_offset)) prev_type != DYN_COL_UINT &&
prev_type != DYN_COL_DECIMAL) && prev_data_offset == data_offset))
{ {
DBUG_PRINT("info", ("Field order: %u Previous data offset: %u" DBUG_PRINT("info", ("Field order: %u Previous data offset: %u"
" >(=) Current data offset: %u", " >(=) Current data offset: %u",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment