mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fixed bug in ISNULL(not_null_expression)
Docs/manual.texi: Changlelog
This commit is contained in:
@ -46926,8 +46926,13 @@ Fixed core dump problem on OSF in @code{gethostbyname_r}.
|
|||||||
@item
|
@item
|
||||||
Fixed that underflowed decimal fields is not zero filled.
|
Fixed that underflowed decimal fields is not zero filled.
|
||||||
@item
|
@item
|
||||||
@code{'+11111'} in overflow for @code{decimal(5,0) unsigned} columns,
|
If we get an overflow when inserting @code{'+11111'} for
|
||||||
Just sign will be dropped.
|
@code{decimal(5,0) unsigned} columns, we will just drop the sign.
|
||||||
|
@item
|
||||||
|
Fixed bug with @code{ISNULL(expression_which_cannot_be_null)}.
|
||||||
|
@item
|
||||||
|
Fixed host lookup bug in the glibc library that we used with the 3.23.50
|
||||||
|
Linux-x86 binaries.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@node News-3.23.50, News-3.23.49, News-3.23.51, News-3.23.x
|
@node News-3.23.50, News-3.23.49, News-3.23.51, News-3.23.x
|
||||||
|
1
mysql-test/r/func_isnull.result
Normal file
1
mysql-test/r/func_isnull.result
Normal file
@ -0,0 +1 @@
|
|||||||
|
id mydate
|
10
mysql-test/t/func_isnull.test
Normal file
10
mysql-test/t/func_isnull.test
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#
|
||||||
|
# test of ISNULL()
|
||||||
|
#
|
||||||
|
|
||||||
|
drop table if exists t1;
|
||||||
|
create table t1 (id int auto_increment primary key not null, mydate date not null);
|
||||||
|
insert into t1 values (0,"2002-05-01"),(0,"2002-05-01"),(0,"2002-05-01");
|
||||||
|
flush tables;
|
||||||
|
select * from t1 where isnull(to_days(mydate));
|
||||||
|
drop table t1;
|
@ -25,9 +25,9 @@
|
|||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Test functions
|
Test functions
|
||||||
** These returns 0LL if false and 1LL if true and null if some arg is null
|
These returns 0LL if false and 1LL if true and null if some arg is null
|
||||||
** 'AND' and 'OR' never return null
|
'AND' and 'OR' never return null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
longlong Item_func_not::val_int()
|
longlong Item_func_not::val_int()
|
||||||
@ -59,8 +59,10 @@ void Item_bool_func2::fix_length_and_dec()
|
|||||||
{
|
{
|
||||||
max_length=1;
|
max_length=1;
|
||||||
|
|
||||||
/* As some compare functions are generated after sql_yacc,
|
/*
|
||||||
we have to check for out of memory conditons here */
|
As some compare functions are generated after sql_yacc,
|
||||||
|
we have to check for out of memory conditons here
|
||||||
|
*/
|
||||||
if (!args[0] || !args[1])
|
if (!args[0] || !args[1])
|
||||||
return;
|
return;
|
||||||
// Make a special case of compare with fields to get nicer DATE comparisons
|
// Make a special case of compare with fields to get nicer DATE comparisons
|
||||||
@ -336,8 +338,10 @@ void Item_func_between::fix_length_and_dec()
|
|||||||
{
|
{
|
||||||
max_length=1;
|
max_length=1;
|
||||||
|
|
||||||
/* As some compare functions are generated after sql_yacc,
|
/*
|
||||||
we have to check for out of memory conditons here */
|
As some compare functions are generated after sql_yacc,
|
||||||
|
we have to check for out of memory conditons here
|
||||||
|
*/
|
||||||
if (!args[0] || !args[1] || !args[2])
|
if (!args[0] || !args[1] || !args[2])
|
||||||
return;
|
return;
|
||||||
cmp_type=args[0]->result_type();
|
cmp_type=args[0]->result_type();
|
||||||
@ -389,7 +393,7 @@ longlong Item_func_between::val_int()
|
|||||||
{
|
{
|
||||||
longlong value=args[0]->val_int(),a,b;
|
longlong value=args[0]->val_int(),a,b;
|
||||||
if ((null_value=args[0]->null_value))
|
if ((null_value=args[0]->null_value))
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
a=args[1]->val_int();
|
a=args[1]->val_int();
|
||||||
b=args[2]->val_int();
|
b=args[2]->val_int();
|
||||||
if (!args[1]->null_value && !args[2]->null_value)
|
if (!args[1]->null_value && !args[2]->null_value)
|
||||||
@ -409,7 +413,7 @@ longlong Item_func_between::val_int()
|
|||||||
{
|
{
|
||||||
double value=args[0]->val(),a,b;
|
double value=args[0]->val(),a,b;
|
||||||
if ((null_value=args[0]->null_value))
|
if ((null_value=args[0]->null_value))
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
a=args[1]->val();
|
a=args[1]->val();
|
||||||
b=args[2]->val();
|
b=args[2]->val();
|
||||||
if (!args[1]->null_value && !args[2]->null_value)
|
if (!args[1]->null_value && !args[2]->null_value)
|
||||||
@ -594,11 +598,10 @@ Item_func_nullif::val_str(String *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CASE expression
|
CASE expression
|
||||||
|
Return the matching ITEM or NULL if all compares (including else) failed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Return the matching ITEM or NULL if all compares (including else) failed */
|
|
||||||
|
|
||||||
Item *Item_func_case::find_item(String *str)
|
Item *Item_func_case::find_item(String *str)
|
||||||
{
|
{
|
||||||
String *first_expr_str,*tmp;
|
String *first_expr_str,*tmp;
|
||||||
@ -786,7 +789,7 @@ void Item_func_case::print(String *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Coalesce - return first not NULL argument.
|
Coalesce - return first not NULL argument.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
String *Item_func_coalesce::val_str(String *str)
|
String *Item_func_coalesce::val_str(String *str)
|
||||||
@ -841,7 +844,7 @@ void Item_func_coalesce::fix_length_and_dec()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** classes and function for the IN operator
|
Classes and function for the IN operator
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int cmp_longlong(longlong *a,longlong *b)
|
static int cmp_longlong(longlong *a,longlong *b)
|
||||||
@ -914,7 +917,7 @@ byte *in_longlong::get_value(Item *item)
|
|||||||
{
|
{
|
||||||
tmp=item->val_int();
|
tmp=item->val_int();
|
||||||
if (item->null_value)
|
if (item->null_value)
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
return (byte*) &tmp;
|
return (byte*) &tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -932,7 +935,7 @@ byte *in_double::get_value(Item *item)
|
|||||||
{
|
{
|
||||||
tmp=item->val();
|
tmp=item->val();
|
||||||
if (item->null_value)
|
if (item->null_value)
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
return (byte*) &tmp;
|
return (byte*) &tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1170,9 +1173,11 @@ longlong Item_cond_and::val_int()
|
|||||||
{
|
{
|
||||||
if (item->val_int() == 0)
|
if (item->val_int() == 0)
|
||||||
{
|
{
|
||||||
/* TODO: In case of NULL, ANSI would require us to continue evaluation
|
/*
|
||||||
until we get a FALSE value or run out of values; This would
|
TODO: In case of NULL, ANSI would require us to continue evaluation
|
||||||
require a lot of unnecessary evaluation, which we skip for now */
|
until we get a FALSE value or run out of values; This would
|
||||||
|
require a lot of unnecessary evaluation, which we skip for now
|
||||||
|
*/
|
||||||
null_value=item->null_value;
|
null_value=item->null_value;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1201,6 +1206,12 @@ longlong Item_cond_or::val_int()
|
|||||||
|
|
||||||
longlong Item_func_isnull::val_int()
|
longlong Item_func_isnull::val_int()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
Handle optimization if the argument can't be null
|
||||||
|
This has to be here because of the test in update_used_tables().
|
||||||
|
*/
|
||||||
|
if (!used_tables_cache)
|
||||||
|
return 0;
|
||||||
(void) args[0]->val();
|
(void) args[0]->val();
|
||||||
return (args[0]->null_value) ? 1 : 0;
|
return (args[0]->null_value) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user