[Commits] 71eee69: MDEV-9167: COLUMN_CHECK fails on valid decimal data

OleksandrByelkin sanja at mariadb.com
Wed Dec 16 12:09:54 EET 2015


revision-id: 71eee693b2ffadaf3d3ae9f68d5a723d9e4b503a (mariadb-10.0.22-70-g71eee69)
parent(s): bd69d7b3f30267011675747e4a74959b71a7ebc6
committer: Oleksandr Byelkin
timestamp: 2015-12-16 11:09:54 +0100
message:

MDEV-9167: COLUMN_CHECK fails on valid decimal data

Check now allows zero length decimals too.

(backporting Adam Chainz patch to 10.0)

---
 mysql-test/r/dyncol.result | 15 +++++++++++++++
 mysql-test/t/dyncol.test   | 12 ++++++++++++
 mysys/ma_dyncol.c          |  3 ++-
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result
index c7eb303..b0d28a8 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 f0b8e04..03e2345 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 06820a0..d7d4a12 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",


More information about the commits mailing list