1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-29225 make explicit_defaults_for_timestamps SESSION variable

make @@explicit_defaults_for_timestamp session variable
This commit is contained in:
Sergei Golubchik
2022-07-02 12:22:10 +02:00
parent 086eb8e23c
commit 4e3728f038
19 changed files with 62 additions and 82 deletions

View File

@ -4478,7 +4478,7 @@ without_overlaps_err:
!sql_field->has_default_function() &&
(sql_field->flags & NOT_NULL_FLAG) &&
(!sql_field->is_timestamp_type() ||
opt_explicit_defaults_for_timestamp)&&
(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP))&&
!sql_field->vers_sys_field())
{
sql_field->flags|= NO_DEFAULT_VALUE_FLAG;
@ -4489,7 +4489,7 @@ without_overlaps_err:
!sql_field->default_value && !sql_field->vcol_info &&
!sql_field->vers_sys_field() &&
sql_field->is_timestamp_type() &&
!opt_explicit_defaults_for_timestamp &&
!(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP) &&
(sql_field->flags & NOT_NULL_FLAG) &&
(type == Field::NONE || type == Field::TIMESTAMP_UN_FIELD))
{
@ -5592,7 +5592,7 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
else
create_table_mode= C_ASSISTED_DISCOVERY;
if (!opt_explicit_defaults_for_timestamp)
if (!(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP))
promote_first_timestamp_column(&alter_info->create_list);
/* We can abort create table for any table type */
@ -10511,7 +10511,7 @@ do_continue:;
create_info->fix_period_fields(thd, alter_info))
DBUG_RETURN(true);
if (!opt_explicit_defaults_for_timestamp)
if (!(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP))
promote_first_timestamp_column(&alter_info->create_list);
#ifdef WITH_PARTITION_STORAGE_ENGINE