• Nikita Malyavin's avatar
    MDEV-16026 MDEV-16481 refactor Sys_var_vers_asof · c6bff469
    Nikita Malyavin authored
    MDEV-16026: Forbid global system_versioning_asof in non-default time zone
    
    * store `system_versioning_asof` in unix time;
    * both session and global vars are processed in session timezone;
    * setting `default` does not copy global variable anymore. Instead, it sets
      system_time to SYSTEM_TIME_UNSPECIFIED, which means that no 'AS OF' time
      is applied and `now()` can be assumed
    
    As a regression, we cannot assign values below 1970 (UTC) anymore
    
    MDEV-16481: set global system_versioning_asof=sf() crashes in specific case
    
    * sys_vars.h: add `MYSQL_TIME` field to `set_var::save_result`
    * sys_vars.ic: get rid of calling `var->value->get_date()` from
     `Sys_var_vers_asof::update()`
    * versioning.sysvars: add test; remove double warning
    
    refactor Sys_var_vers_asof
    
    * inherit from sys_var rather than Sys_var_enum
    * remove junk "DEFAULT" keyword. There is DEFAULT in SQL grammar for it.
    * make all conversions in check() to avoid possible errors
    * avoid double var->value evaluation, which could
      consequence in undefined behavior
    c6bff469
sql_select.cc 911 KB