mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
Bug #26537: item_unhex() was not expected
to return NULL for non-NULL arguments. This is not the case as it can return NULL for invalid hexidecimal strings. Fixed by setting the maybe_null flag.
This commit is contained in:
parent
b3cb846680
commit
4a6efcd664
3 changed files with 17 additions and 1 deletions
|
@ -1940,4 +1940,10 @@ abcxx
|
||||||
select lpad('abc', cast(5 as unsigned integer), 'x');
|
select lpad('abc', cast(5 as unsigned integer), 'x');
|
||||||
lpad('abc', cast(5 as unsigned integer), 'x')
|
lpad('abc', cast(5 as unsigned integer), 'x')
|
||||||
xxabc
|
xxabc
|
||||||
|
SELECT UNHEX('G');
|
||||||
|
UNHEX('G')
|
||||||
|
NULL
|
||||||
|
SELECT UNHEX('G') IS NULL;
|
||||||
|
UNHEX('G') IS NULL
|
||||||
|
1
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
|
|
|
@ -1008,4 +1008,10 @@ select repeat('a', cast(2 as unsigned int));
|
||||||
select rpad('abc', cast(5 as unsigned integer), 'x');
|
select rpad('abc', cast(5 as unsigned integer), 'x');
|
||||||
select lpad('abc', cast(5 as unsigned integer), 'x');
|
select lpad('abc', cast(5 as unsigned integer), 'x');
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #26537: UNHEX() IS NULL comparison fails
|
||||||
|
#
|
||||||
|
SELECT UNHEX('G');
|
||||||
|
SELECT UNHEX('G') IS NULL;
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
|
@ -605,7 +605,11 @@ class Item_func_unhex :public Item_str_func
|
||||||
{
|
{
|
||||||
String tmp_value;
|
String tmp_value;
|
||||||
public:
|
public:
|
||||||
Item_func_unhex(Item *a) :Item_str_func(a) {}
|
Item_func_unhex(Item *a) :Item_str_func(a)
|
||||||
|
{
|
||||||
|
/* there can be bad hex strings */
|
||||||
|
maybe_null= 1;
|
||||||
|
}
|
||||||
const char *func_name() const { return "unhex"; }
|
const char *func_name() const { return "unhex"; }
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
|
|
Loading…
Add table
Reference in a new issue