MDEV-26786 Inserting NULL into base column breaks NATURAL_SORT_KEY column
When returning non-null value from natural_sort_key, make sure Item::null_value is false.
This commit is contained in:
parent
6c5c1fd55a
commit
5b5a67b2a9
@ -190,3 +190,16 @@ pic120 pic2120
|
||||
pic121 pic2121
|
||||
pic02000 pic32000
|
||||
tom tom
|
||||
create table t (a varchar(8), b varchar(8) as (natural_sort_key(a)));
|
||||
insert into t (a) values ('a2'),(NULL),('a11');
|
||||
select * from t order by b;
|
||||
a b
|
||||
NULL NULL
|
||||
a2 a02
|
||||
a11 a111
|
||||
select a, b from t order by b;
|
||||
a b
|
||||
NULL NULL
|
||||
a2 a02
|
||||
a11 a111
|
||||
drop table t;
|
||||
|
@ -86,3 +86,10 @@ SELECT RPAD(val,20,' ') value, NATURAL_SORT_KEY(val) FROM
|
||||
('a01b3')
|
||||
)AS data ORDER BY 2,1;
|
||||
|
||||
# MDEV-27686 (null value indicator not always reset)
|
||||
create table t (a varchar(8), b varchar(8) as (natural_sort_key(a)));
|
||||
insert into t (a) values ('a2'),(NULL),('a11');
|
||||
select * from t order by b;
|
||||
select a, b from t order by b;
|
||||
drop table t;
|
||||
|
||||
|
@ -5682,7 +5682,7 @@ String *Item_func_natural_sort_key::val_str(String *out)
|
||||
if (tmp.copy(out, cs, &errs) || out->copy(tmp))
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
null_value= false;
|
||||
return out;
|
||||
|
||||
error_exit:
|
||||
|
Loading…
x
Reference in New Issue
Block a user