Commit 70c08df4 authored by unknown's avatar unknown

MDEV-5840: group_concat( column_json(dynamic_column )) return empty result

Fixed max_length of dynamic columns json/create/add functions.
parent 89406110
...@@ -1755,3 +1755,16 @@ Warning 1265 Data truncated for column 'dyncol' at row 1 ...@@ -1755,3 +1755,16 @@ Warning 1265 Data truncated for column 'dyncol' at row 1
SELECT COLUMN_ADD( COLUMN_ADD( dyncol, 1, REPEAT('b',130) ), 3, 'y' ) FROM t1; SELECT COLUMN_ADD( COLUMN_ADD( dyncol, 1, REPEAT('b',130) ), 3, 'y' ) FROM t1;
ERROR HY000: Encountered illegal format of dynamic column string ERROR HY000: Encountered illegal format of dynamic column string
DROP TABLE t1; DROP TABLE t1;
#
#MDEV-5840: group_concat( column_json(dynamic_column )) return empty
#result
#
create table t1 (dyn blob);
insert into t1 values (column_create('name1','value1','name2','value2'));
select group_concat(cast(column_json(dyn) as char)) from t1;
group_concat(cast(column_json(dyn) as char))
{"name1":"value1","name2":"value2"}
drop table t1;
#
# end of 10.0 tests
#
...@@ -820,3 +820,17 @@ INSERT INTO t1 SET dyncol = COLUMN_CREATE( 3, REPEAT('a',330), 4, 'x' ); ...@@ -820,3 +820,17 @@ INSERT INTO t1 SET dyncol = COLUMN_CREATE( 3, REPEAT('a',330), 4, 'x' );
SELECT COLUMN_ADD( COLUMN_ADD( dyncol, 1, REPEAT('b',130) ), 3, 'y' ) FROM t1; SELECT COLUMN_ADD( COLUMN_ADD( dyncol, 1, REPEAT('b',130) ), 3, 'y' ) FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo #MDEV-5840: group_concat( column_json(dynamic_column )) return empty
--echo #result
--echo #
create table t1 (dyn blob);
insert into t1 values (column_create('name1','value1','name2','value2'));
select group_concat(cast(column_json(dyn) as char)) from t1;
drop table t1;
--echo #
--echo # end of 10.0 tests
--echo #
...@@ -4279,6 +4279,7 @@ bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref) ...@@ -4279,6 +4279,7 @@ bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref)
void Item_func_dyncol_create::fix_length_and_dec() void Item_func_dyncol_create::fix_length_and_dec()
{ {
max_length= MAX_BLOB_WIDTH;
maybe_null= TRUE; maybe_null= TRUE;
collation.set(&my_charset_bin); collation.set(&my_charset_bin);
decimals= 0; decimals= 0;
......
...@@ -1174,6 +1174,7 @@ public: ...@@ -1174,6 +1174,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() void fix_length_and_dec()
{ {
max_length= MAX_BLOB_WIDTH;
maybe_null= 1; maybe_null= 1;
collation.set(&my_charset_bin); collation.set(&my_charset_bin);
decimals= 0; decimals= 0;
......
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