mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge branch '10.6' into 10.7
This commit is contained in:
@ -2253,13 +2253,17 @@ bool Column_definition::prepare_stage2(handler *file,
|
||||
|
||||
void promote_first_timestamp_column(List<Create_field> *column_definitions)
|
||||
{
|
||||
bool first= true;
|
||||
for (Create_field &column_definition : *column_definitions)
|
||||
{
|
||||
if (column_definition.is_timestamp_type() || // TIMESTAMP
|
||||
column_definition.unireg_check == Field::TIMESTAMP_OLD_FIELD) // Legacy
|
||||
{
|
||||
if (!column_definition.explicitly_nullable)
|
||||
column_definition.flags|= NOT_NULL_FLAG;
|
||||
DBUG_PRINT("info", ("field-ptr:%p", column_definition.field));
|
||||
if ((column_definition.flags & NOT_NULL_FLAG) != 0 && // NOT NULL,
|
||||
if (first &&
|
||||
(column_definition.flags & NOT_NULL_FLAG) != 0 && // NOT NULL,
|
||||
column_definition.default_value == NULL && // no constant default,
|
||||
column_definition.unireg_check == Field::NONE && // no function default
|
||||
column_definition.vcol_info == NULL &&
|
||||
@ -2273,7 +2277,7 @@ void promote_first_timestamp_column(List<Create_field> *column_definitions)
|
||||
));
|
||||
column_definition.unireg_check= Field::TIMESTAMP_DNUN_FIELD;
|
||||
}
|
||||
return;
|
||||
first= false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3597,7 +3601,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;
|
||||
@ -3608,7 +3612,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))
|
||||
{
|
||||
@ -4771,7 +4775,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 */
|
||||
@ -10029,7 +10033,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
|
||||
|
Reference in New Issue
Block a user