mirror of
https://github.com/MariaDB/server.git
synced 2026-04-23 00:35:32 +02:00
MDEV-17257 Server crashes in Item::field_type_for_temporal_comparison or in get_datetime_value on SELECT with YEAR field and IN
This commit is contained in:
parent
853dee854c
commit
8e716138ce
3 changed files with 41 additions and 3 deletions
|
|
@ -4172,11 +4172,20 @@ void Item_func_in::fix_length_and_dec()
|
|||
if (field_item->field_type() == MYSQL_TYPE_LONGLONG ||
|
||||
field_item->field_type() == MYSQL_TYPE_YEAR)
|
||||
{
|
||||
bool all_converted= TRUE;
|
||||
bool all_converted= true;
|
||||
for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
|
||||
{
|
||||
if (!convert_const_to_int(thd, field_item, &arg[0]))
|
||||
all_converted= FALSE;
|
||||
/*
|
||||
Explicit NULLs should not affect data cmp_type resolution:
|
||||
- we ignore NULLs when calling collect_cmp_type()
|
||||
- we ignore NULLs here
|
||||
So this expression:
|
||||
year_column IN (DATE'2001-01-01', NULL)
|
||||
switches from TIME_RESULT to INT_RESULT.
|
||||
*/
|
||||
if (arg[0]->type() != Item::NULL_ITEM &&
|
||||
!convert_const_to_int(thd, field_item, &arg[0]))
|
||||
all_converted= false;
|
||||
}
|
||||
if (all_converted)
|
||||
cmp_type= INT_RESULT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue