mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
Merge mysql.com:/home/timka/mysql/src/4.1-virgin
into mysql.com:/home/timka/mysql/src/4.1-dbg
This commit is contained in:
commit
1613bf2731
3 changed files with 24 additions and 1 deletions
|
@ -697,3 +697,9 @@ quote(ltrim(concat(' ', 'a')))
|
|||
select quote(trim(concat(' ', 'a')));
|
||||
quote(trim(concat(' ', 'a')))
|
||||
'a'
|
||||
select trim(null from 'kate') as "must_be_null";
|
||||
must_be_null
|
||||
NULL
|
||||
select trim('xyz' from null) as "must_be_null";
|
||||
must_be_null
|
||||
NULL
|
||||
|
|
|
@ -435,3 +435,11 @@ drop table t1;
|
|||
|
||||
select quote(ltrim(concat(' ', 'a')));
|
||||
select quote(trim(concat(' ', 'a')));
|
||||
|
||||
#
|
||||
# Bug#7455 unexpected result: TRIM(<NULL> FROM <whatever>) gives NOT NULL
|
||||
# According to ANSI if one of the TRIM arguments is NULL, then the result
|
||||
# must be NULL too.
|
||||
#
|
||||
select trim(null from 'kate') as "must_be_null";
|
||||
select trim('xyz' from null) as "must_be_null";
|
||||
|
|
|
@ -1302,9 +1302,18 @@ String *Item_func_trim::val_str(String *str)
|
|||
return 0; /* purecov: inspected */
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String tmp(buff,sizeof(buff),res->charset());
|
||||
String *remove_str= (arg_count==2) ? args[1]->val_str(&tmp) : &remove;
|
||||
uint remove_length;
|
||||
LINT_INIT(remove_length);
|
||||
String *remove_str; /* The string to remove from res. */
|
||||
|
||||
if (arg_count == 2)
|
||||
{
|
||||
remove_str= args[1]->val_str(&tmp);
|
||||
if ((null_value= args[1]->null_value))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
remove_str= &remove; /* Default value. */
|
||||
|
||||
if (!remove_str || (remove_length=remove_str->length()) == 0 ||
|
||||
remove_length > res->length())
|
||||
|
|
Loading…
Add table
Reference in a new issue