diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 3 | ||||
-rw-r--r-- | sql/field.h | 24 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 2 |
3 files changed, 15 insertions, 14 deletions
diff --git a/sql/field.cc b/sql/field.cc index df6a67b616e..01786d932d6 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -9757,7 +9757,6 @@ void Column_definition::init_for_tmp_table(enum_field_types sql_type_arg, FLAGSTR(pack_flag, FIELDFLAG_DECIMAL), f_packtype(pack_flag))); vcol_info= 0; - create_if_not_exists= FALSE; DBUG_VOID_RETURN; } @@ -10429,7 +10428,6 @@ Field *make_field(TABLE_SHARE *share, Column_definition::Column_definition(THD *thd, Field *old_field, Field *orig_field) { - field= old_field; field_name= old_field->field_name; length= old_field->field_length; flags= old_field->flags; @@ -10441,7 +10439,6 @@ Column_definition::Column_definition(THD *thd, Field *old_field, comment= old_field->comment; decimals= old_field->decimals(); vcol_info= old_field->vcol_info; - create_if_not_exists= FALSE; option_list= old_field->option_list; option_struct= old_field->option_struct; diff --git a/sql/field.h b/sql/field.h index 8d2e67c8541..5ad4dcf30b3 100644 --- a/sql/field.h +++ b/sql/field.h @@ -3440,20 +3440,15 @@ public: uint decimals, flags, pack_length, key_length; Field::utype unireg_check; TYPELIB *interval; // Which interval to use - TYPELIB *save_interval; // Temporary copy for the above - // Used only for UCS2 intervals List<String> interval_list; CHARSET_INFO *charset; uint32 srid; Field::geometry_type geom_type; - Field *field; // For alter table engine_option_value *option_list; /** structure with parsed options (for comparing fields in ALTER TABLE) */ ha_field_option_struct *option_struct; - uint8 interval_id; // For rea_create_table - uint offset,pack_flag; - bool create_if_not_exists; // Used in ALTER TABLE IF NOT EXISTS + uint pack_flag; /* This is additinal data provided for any computed(virtual) field. @@ -3467,8 +3462,8 @@ public: def(0), on_update(0), sql_type(MYSQL_TYPE_NULL), flags(0), pack_length(0), key_length(0), interval(0), srid(0), geom_type(Field::GEOM_GEOMETRY), - field(0), option_list(NULL), option_struct(NULL), - create_if_not_exists(false), vcol_info(0) + option_list(NULL), option_struct(NULL), + vcol_info(0) { interval_list.empty(); } @@ -3518,12 +3513,21 @@ class Create_field :public Column_definition public: const char *change; // If done with alter table const char *after; // Put column after this one + Field *field; // For alter table + TYPELIB *save_interval; // Temporary copy for the above + // Used only for UCS2 intervals + uint offset; + uint8 interval_id; // For rea_create_table + bool create_if_not_exists; // Used in ALTER TABLE IF NOT EXISTS + Create_field(): - Column_definition(), change(0), after(0) + Column_definition(), change(0), after(0), + field(0), create_if_not_exists(false) { } Create_field(THD *thd, Field *old_field, Field *orig_field): Column_definition(thd, old_field, orig_field), - change(old_field->field_name), after(0) + change(old_field->field_name), after(0), + field(old_field), create_if_not_exists(false) { } /* Used to make a clone of this object for ALTER/CREATE TABLE */ Create_field *clone(MEM_ROOT *mem_root) const; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 71a8ef77007..6a90bcbb8f9 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -867,7 +867,6 @@ void LEX::init_last_field(Column_definition *field, const char *field_name, void LEX::set_last_field_type(const Lex_field_type_st &type) { last_field->sql_type= type.field_type(); - last_field->create_if_not_exists= check_exists; last_field->charset= charset; if (type.length()) @@ -6150,6 +6149,7 @@ field_spec: lex->alter_info.create_list.push_back($$, thd->mem_root); + $$->create_if_not_exists= Lex->check_exists; if ($$->flags & PRI_KEY_FLAG) add_key_to_list(lex, &$1, Key::PRIMARY, Lex->check_exists); else if ($$->flags & UNIQUE_KEY_FLAG) |