Commit 9a3ff078 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-8565: COLUMN_CHECK fails on valid data

Check allows zero lengts int/uint now.
parent 151f9673
...@@ -1805,5 +1805,20 @@ set impressions = column_add(impressions, ...@@ -1805,5 +1805,20 @@ set impressions = column_add(impressions,
); );
drop table t1; drop table t1;
# #
# MDEV-8565: COLUMN_CHECK fails on valid data
#
SELECT COLUMN_CHECK(COLUMN_CREATE('a',0,'b','1'));
COLUMN_CHECK(COLUMN_CREATE('a',0,'b','1'))
1
SELECT COLUMN_CHECK(COLUMN_CREATE('a',1,'b','1'));
COLUMN_CHECK(COLUMN_CREATE('a',1,'b','1'))
1
SELECT COLUMN_JSON(COLUMN_CREATE('a',0,'b','1'));
COLUMN_JSON(COLUMN_CREATE('a',0,'b','1'))
{"a":0,"b":"1"}
SELECT COLUMN_JSON(COLUMN_CREATE('a',1,'b','1'));
COLUMN_JSON(COLUMN_CREATE('a',1,'b','1'))
{"a":1,"b":"1"}
#
# end of 10.0 tests # end of 10.0 tests
# #
...@@ -871,6 +871,18 @@ set impressions = column_add(impressions, ...@@ -871,6 +871,18 @@ set impressions = column_add(impressions,
drop table t1; drop table t1;
--echo #
--echo # MDEV-8565: COLUMN_CHECK fails on valid data
--echo #
SELECT COLUMN_CHECK(COLUMN_CREATE('a',0,'b','1'));
SELECT COLUMN_CHECK(COLUMN_CREATE('a',1,'b','1'));
SELECT COLUMN_JSON(COLUMN_CREATE('a',0,'b','1'));
SELECT COLUMN_JSON(COLUMN_CREATE('a',1,'b','1'));
--echo # --echo #
--echo # end of 10.0 tests --echo # end of 10.0 tests
--echo # --echo #
...@@ -3723,10 +3723,12 @@ mariadb_dyncol_check(DYNAMIC_COLUMN *str) ...@@ -3723,10 +3723,12 @@ mariadb_dyncol_check(DYNAMIC_COLUMN *str)
if (prev_type != DYN_COL_NULL) if (prev_type != DYN_COL_NULL)
{ {
/* 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_UINT) && 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",
(uint)i, (uint)i,
(uint)prev_data_offset, (uint)prev_data_offset,
(uint)data_offset)); (uint)data_offset));
......
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