Commit 30841c03 authored by Sergei Golubchik's avatar Sergei Golubchik Committed by Aleksey Midenkov

Revert "Parser: no implicit NOT NULL for system fields [fixes #163]"

This reverts commit 1cfdff5fe3c0044fa08adf5da9088dc46cc646db.

Fix it differently.
Cleanup, test results didn't change.
parent e60da371
......@@ -10704,7 +10704,6 @@ Column_definition::Column_definition(THD *thd, Field *old_field,
pack_flag= 0;
compression_method_ptr= 0;
versioning= VERSIONING_NOT_SET;
implicit_not_null= false;
if (orig_field)
{
......
......@@ -4155,7 +4155,6 @@ class Column_definition: public Sql_alloc,
*check_constraint; // Check constraint
enum_column_versioning versioning;
bool implicit_not_null;
Column_definition()
:Type_handler_hybrid_field_type(&type_handler_null),
......@@ -4167,8 +4166,7 @@ class Column_definition: public Sql_alloc,
srid(0), geom_type(Field::GEOM_GEOMETRY),
option_list(NULL), pack_flag(0),
vcol_info(0), default_value(0), check_constraint(0),
versioning(VERSIONING_NOT_SET),
implicit_not_null(false)
versioning(VERSIONING_NOT_SET)
{
interval_list.empty();
}
......
......@@ -2169,10 +2169,9 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
{
packet->append(STRING_WITH_LEN(" GENERATED ALWAYS AS ROW END"));
}
if (flags & NOT_NULL_FLAG)
else if (flags & NOT_NULL_FLAG)
packet->append(STRING_WITH_LEN(" NOT NULL"));
else if (field->type() == MYSQL_TYPE_TIMESTAMP && !field->vers_sys_field())
else if (field->type() == MYSQL_TYPE_TIMESTAMP)
{
/*
TIMESTAMP field require explicit NULL flag, because unlike
......
......@@ -6393,11 +6393,6 @@ field_def:
}
DBUG_ASSERT(p);
*p= field_name;
if (lex->last_field->implicit_not_null)
{
lex->last_field->flags&= ~NOT_NULL_FLAG;
lex->last_field->implicit_not_null= false;
}
}
;
......@@ -6636,10 +6631,7 @@ field_type_temporal:
Unless --explicit-defaults-for-timestamp is given.
*/
if (!opt_explicit_defaults_for_timestamp)
{
Lex->last_field->flags|= NOT_NULL_FLAG;
Lex->last_field->implicit_not_null= true;
}
$$.set(opt_mysql56_temporal_format ?
static_cast<const Type_handler*>(&type_handler_timestamp2):
static_cast<const Type_handler*>(&type_handler_timestamp),
......@@ -6830,11 +6822,7 @@ opt_attribute_list:
;
attribute:
NULL_SYM
{
Lex->last_field->flags&= ~ NOT_NULL_FLAG;
Lex->last_field->implicit_not_null= false;
}
NULL_SYM { Lex->last_field->flags&= ~ NOT_NULL_FLAG; }
| DEFAULT column_default_expr { Lex->last_field->default_value= $2; }
| ON UPDATE_SYM NOW_SYM opt_default_time_precision
{
......@@ -6874,7 +6862,6 @@ asrow_attribute:
not NULL_SYM
{
Lex->last_field->flags|= NOT_NULL_FLAG;
Lex->last_field->implicit_not_null= false;
}
| opt_primary KEY_SYM
{
......
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