← Back to team overview

maria-developers team mailing list archive

Re: MDEV-16094 Crash when using AS OF with a stored function

 

Hi, Alexander!

Looks ok. A couple minor comments:

On May 07, Alexander Barkov wrote:

> commit fa6cf08ad1c01e990cd6a497a0403c1bbfe0b27e
> Author: Alexander Barkov <bar@xxxxxxxxxxx>
> Date:   Mon May 7 16:59:34 2018 +0400
> 
>     MDEV-16094 Crash when using AS OF with a stored function
>     MDEV-16100 FOR SYSTEM_TIME erroneously resolves string user variables as transaction IDs
>
> diff --git a/sql/item.h b/sql/item.h
> index e1a8906..3759693 100644
> --- a/sql/item.h
> +++ b/sql/item.h
> @@ -4212,6 +4216,10 @@ class Item_hex_hybrid: public Item_hex_constant
>    {
>      return &type_handler_longlong;
>    }
> +  const Type_handler *type_handler_for_system_time() const

why new method? you could've used cast_to_int_type_handler()
looks like it has the same semantics.

> +  {
> +    return &type_handler_longlong;
> +  }
>    void print(String *str, enum_query_type query_type);
>    Item *get_copy(THD *thd)
>    { return get_item_copy<Item_hex_hybrid>(thd, this); }
> diff --git a/sql/sql_select.cc b/sql/sql_select.cc
> index 320e631..04abf54 100644
> --- a/sql/sql_select.cc
> +++ b/sql/sql_select.cc
> @@ -839,11 +839,13 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
>  
>      if (vers_conditions)
>      {
> +      thd->where= "for system_time clause";

better "FOR SYSTEM_TIME". Compare

 ERROR 42S22: Неизвестный столбец 'now' в 'for system_time clause'
 ERROR 42S22: Неизвестный столбец 'now' в 'FOR SYSTEM_TIME'

>        /* TODO: do resolve fix_length_and_dec(), fix_fields(). This requires
>          storing vers_conditions as Item and make some magic related to
>          vers_system_time_t/VERS_TRX_ID at stage of fix_fields()
>          (this is large refactoring). */
> -      vers_conditions.resolve_units(timestamps_only);
> +      if (vers_conditions.resolve_units(thd))
> +        DBUG_RETURN(-1);
>        if (timestamps_only && (vers_conditions.start.unit == VERS_TRX_ID ||
>          vers_conditions.end.unit == VERS_TRX_ID))
>        {

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx


Follow ups

References