Browse Source

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

This reverts commit 1cfdff5fe3.

Fix it differently.
Cleanup, test results didn't change.
pull/478/head
Sergei Golubchik 8 years ago
committed by Aleksey Midenkov
parent
commit
30841c0382
  1. 1
      sql/field.cc
  2. 4
      sql/field.h
  3. 5
      sql/sql_show.cc
  4. 15
      sql/sql_yacc.yy

1
sql/field.cc

@ -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)
{

4
sql/field.h

@ -4155,7 +4155,6 @@ public:
*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 @@ public:
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();
}

5
sql/sql_show.cc

@ -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

15
sql/sql_yacc.yy

@ -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
{

Loading…
Cancel
Save