1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä
2021-11-29 10:33:06 +02:00
40 changed files with 897 additions and 99 deletions

View File

@@ -3610,7 +3610,7 @@ int select_max_min_finder_subselect::send_data(List<Item> &items)
if (!cache)
{
cache= val_item->get_cache(thd);
switch (val_item->result_type()) {
switch (val_item->cmp_type()) {
case REAL_RESULT:
op= &select_max_min_finder_subselect::cmp_real;
break;
@@ -3623,8 +3623,13 @@ int select_max_min_finder_subselect::send_data(List<Item> &items)
case DECIMAL_RESULT:
op= &select_max_min_finder_subselect::cmp_decimal;
break;
case ROW_RESULT:
case TIME_RESULT:
if (val_item->field_type() == MYSQL_TYPE_TIME)
op= &select_max_min_finder_subselect::cmp_time;
else
op= &select_max_min_finder_subselect::cmp_str;
break;
case ROW_RESULT:
// This case should never be choosen
DBUG_ASSERT(0);
op= 0;
@@ -3669,6 +3674,22 @@ bool select_max_min_finder_subselect::cmp_int()
return (val1 < val2);
}
bool select_max_min_finder_subselect::cmp_time()
{
Item *maxmin= ((Item_singlerow_subselect *)item)->element_index(0);
longlong val1= cache->val_time_packed(), val2= maxmin->val_time_packed();
/* Ignore NULLs for ANY and keep them for ALL subqueries */
if (cache->null_value)
return (is_all && !maxmin->null_value) || (!is_all && maxmin->null_value);
if (maxmin->null_value)
return !is_all;
if (fmax)
return(val1 > val2);
return (val1 < val2);
}
bool select_max_min_finder_subselect::cmp_decimal()
{
Item *maxmin= ((Item_singlerow_subselect *)item)->element_index(0);
@@ -3695,7 +3716,7 @@ bool select_max_min_finder_subselect::cmp_str()
but added for safety
*/
val1= cache->val_str(&buf1);
val2= maxmin->val_str(&buf1);
val2= maxmin->val_str(&buf2);
/* Ignore NULLs for ANY and keep them for ALL subqueries */
if (cache->null_value)