Commit c8299e62 authored by Sachin Setiya's avatar Sachin Setiya

This commit solves a couple of issues

1st. Create_field does not have function vers_sys_field() kind of handy
function, second I think Create_field and Field should not divert much , and
Field does have this function.

2nd. Versioning column does not have NOT_NULL_FLAG, since they can never be
null. So I have added NOT_NULL_FLAG.

3rd. Since I added NOT_NULL_FLAG this created one issue , versioning column
of datatype bigint unsigned were getting NO_DEFAULT_VALUE_FLAG. This makes
test like versioning.insert to fail, Reason being If a column gets this
flag if we insert 'default' value it will generate error(that is why ) test
was failing. So now versioning column wont get NO_DEFAULT_VALUE_FLAG flag.
parent 16be7469
......@@ -10475,8 +10475,8 @@ bool Column_definition::check(THD *thd)
TIMESTAMP columns get implicit DEFAULT value when
explicit_defaults_for_timestamp is not set.
*/
if (opt_explicit_defaults_for_timestamp ||
!is_timestamp_type())
if ((opt_explicit_defaults_for_timestamp ||
!is_timestamp_type()) && !vers_sys_field())
{
flags|= NO_DEFAULT_VALUE_FLAG;
}
......
......@@ -4214,6 +4214,10 @@ class Column_definition: public Sql_alloc,
length*= charset->mbmaxlen;
key_length= pack_length;
}
bool vers_sys_field() const
{
return flags & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG);
}
void create_length_to_internal_length_bit();
void create_length_to_internal_length_newdecimal();
......
......@@ -4206,7 +4206,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
!sql_field->has_default_function() &&
(sql_field->flags & NOT_NULL_FLAG) &&
(!sql_field->is_timestamp_type() ||
opt_explicit_defaults_for_timestamp))
opt_explicit_defaults_for_timestamp)&&
!sql_field->vers_sys_field())
{
sql_field->flags|= NO_DEFAULT_VALUE_FLAG;
sql_field->pack_flag|= FIELDFLAG_NO_DEFAULT;
......
......@@ -6586,7 +6586,7 @@ field_def:
my_yyabort_error((ER_VERS_DUPLICATE_ROW_START_END, MYF(0),
"START", field_name.str));
}
lex->last_field->flags|= VERS_SYS_START_FLAG;
lex->last_field->flags|= VERS_SYS_START_FLAG | NOT_NULL_FLAG;
break;
case 0:
p= &info.as_row.end;
......@@ -6595,7 +6595,7 @@ field_def:
my_yyabort_error((ER_VERS_DUPLICATE_ROW_START_END, MYF(0),
"END", field_name.str));
}
lex->last_field->flags|= VERS_SYS_END_FLAG;
lex->last_field->flags|= VERS_SYS_END_FLAG | NOT_NULL_FLAG;
break;
default:
/* Not Reachable */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment