diff options
author | Nikita Malyavin <nikitamalyavin@gmail.com> | 2019-07-18 23:11:16 +1000 |
---|---|---|
committer | Nikita Malyavin <nikitamalyavin@gmail.com> | 2021-07-27 14:15:01 +0300 |
commit | c6bff46958faa745f529ac17101a63377925dbd8 (patch) | |
tree | 1f6cc52c96868a05789b614be27e25da3d8eb15a /sql/set_var.h | |
parent | f50eb0d398f5f5eb2110192be436e70acd44cb9d (diff) | |
download | mariadb-git-c6bff46958faa745f529ac17101a63377925dbd8.tar.gz |
MDEV-16026 MDEV-16481 refactor Sys_var_vers_asof
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
Diffstat (limited to 'sql/set_var.h')
-rw-r--r-- | sql/set_var.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/set_var.h b/sql/set_var.h index 12e025e4696..6e84c0bd09c 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -279,6 +279,16 @@ public: /** + Structure for holding unix timestamp and high precision second part. + */ +typedef struct my_time_t_hires +{ + my_time_t unix_time; + ulong second_part; +} my_time_t_hires; + + +/** set_var_base descendant for assignments to the system variables. */ class set_var :public set_var_base @@ -296,6 +306,7 @@ public: plugin_ref *plugins; ///< for Sys_var_pluginlist Time_zone *time_zone; ///< for Sys_var_tz LEX_STRING string_value; ///< for Sys_var_charptr and others + my_time_t_hires timestamp; ///< for Sys_var_vers_asof const void *ptr; ///< for Sys_var_struct } save_result; LEX_CSTRING base; /**< for structured variables, like keycache_name.variable_name */ |