diff options
-rw-r--r-- | mysql-test/r/dyncol.result | 15 | ||||
-rw-r--r-- | mysql-test/t/dyncol.test | 12 | ||||
-rw-r--r-- | mysys/ma_dyncol.c | 3 |
3 files changed, 29 insertions, 1 deletions
diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index c7eb303983a..b0d28a81043 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1858,5 +1858,20 @@ SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET utf8), 1 AS CHAR 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 # diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index f0b8e0444f1..03e2345ba1c 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -909,5 +909,17 @@ SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET latin1), 1 AS CH 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 # end of 10.0 tests --echo # diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 06820a0c3c5..d7d4a127a75 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -3725,7 +3725,8 @@ mariadb_dyncol_check(DYNAMIC_COLUMN *str) /* It is not first entry */ if (prev_data_offset > data_offset || ((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" " >(=) Current data offset: %u", |