diff options
author | Monty <monty@mariadb.org> | 2015-08-18 11:27:00 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2015-08-18 11:27:00 +0300 |
commit | 4374da63f03abc472f68f42e4e93261a18bfe417 (patch) | |
tree | 4e6ee59be4da4839e8915532b26c0144138e156a /sql | |
parent | 5fe8b747e9e3440f2f746accca0eb11e287a6713 (diff) | |
parent | dfac82e44dd665ab218348765df2b519db4c10dc (diff) | |
download | mariadb-git-4374da63f03abc472f68f42e4e93261a18bfe417.tar.gz |
Merge /my/maria-10.1-default into 10.1
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 18 | ||||
-rw-r--r-- | sql/field.h | 8 | ||||
-rw-r--r-- | sql/item_geofunc.cc | 5 | ||||
-rw-r--r-- | sql/opt_range.cc | 4 | ||||
-rw-r--r-- | sql/sp_head.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 14 |
6 files changed, 41 insertions, 10 deletions
diff --git a/sql/field.cc b/sql/field.cc index 6ca0d4a7d63..5d45a8d39d1 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -9463,14 +9463,6 @@ bool Create_field::check(THD *thd) sql_type= vcol_info->get_real_type(); } - /* - Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and - it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP. - */ - if (!def && unireg_check == Field::NONE && - (flags & NOT_NULL_FLAG) && !is_timestamp_type(sql_type)) - flags|= NO_DEFAULT_VALUE_FLAG; - sign_len= flags & UNSIGNED_FLAG ? 0 : 1; switch (sql_type) { @@ -9663,6 +9655,16 @@ bool Create_field::check(THD *thd) /* Remember the value of length */ char_length= length; + /* + Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and + it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP. + We need to do this check here and in mysql_create_prepare_table() as + sp_head::fill_field_definition() calls this function. + */ + if (!def && unireg_check == Field::NONE && + (flags & NOT_NULL_FLAG) && !is_timestamp_type(sql_type)) + flags|= NO_DEFAULT_VALUE_FLAG; + if (!(flags & BLOB_FLAG) && ((length > max_field_charlength && (sql_type != MYSQL_TYPE_VARCHAR || def)) || diff --git a/sql/field.h b/sql/field.h index 8c4219513a9..c059c5c78b9 100644 --- a/sql/field.h +++ b/sql/field.h @@ -3084,6 +3084,14 @@ public: { return 255 - FRM_VCOL_HEADER_SIZE(interval != NULL); } + + bool has_default_function() const + { + return (unireg_check == Field::TIMESTAMP_DN_FIELD || + unireg_check == Field::TIMESTAMP_DNUN_FIELD || + unireg_check == Field::TIMESTAMP_UN_FIELD || + unireg_check == Field::NEXT_NUMBER); + } }; diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index a048462c7aa..065ba6d30b4 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -1155,6 +1155,8 @@ static int setup_relate_func(Geometry *g1, Geometry *g2, uint shape_a, shape_b; uint n_operands= 0; int last_shape_pos; + UNINIT_VAR(shape_a); + UNINIT_VAR(shape_b); last_shape_pos= func->get_next_expression_pos(); if (func->reserve_op_buffer(1)) @@ -2398,7 +2400,8 @@ String *Item_func_pointonsurface::val_str(String *str) String *result= 0; const Gcalc_scan_iterator::point *pprev= NULL; uint32 srid; - + UNINIT_VAR(px); + UNINIT_VAR(py); null_value= 1; if ((args[0]->null_value || diff --git a/sql/opt_range.cc b/sql/opt_range.cc index af50fb8a49b..c73284f3113 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2931,9 +2931,11 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) break; bitmap_set_bit(&handled_columns, key_part->fieldnr-1); } - double selectivity_mult; if (i) { + double selectivity_mult; + UNINIT_VAR(selectivity_mult); + /* There is at least 1-column prefix of columns whose selectivity has not yet been accounted for. diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 777775e6e39..667cac41d43 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1133,6 +1133,8 @@ sp_head::execute(THD *thd, bool merge_da_on_success) Diagnostics_area *da= thd->get_stmt_da(); Warning_info sp_wi(da->warning_info_id(), false, true); + UNINIT_VAR(saved_creation_ctx); + /* this 7*STACK_MIN_SIZE is a complex matter with a long history (see it!) */ if (check_stack_overrun(thd, 7 * STACK_MIN_SIZE, (uchar*)&old_packet)) DBUG_RETURN(TRUE); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index fa14204110a..091dc0cb761 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4096,6 +4096,20 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, { Field::utype type= (Field::utype) MTYP_TYPENR(sql_field->unireg_check); + /* + Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and + it is NOT NULL, not an AUTO_INCREMENT field, not a TIMESTAMP and not + updated trough a NOW() function. + */ + if (!sql_field->def && + !sql_field->has_default_function() && + (sql_field->flags & NOT_NULL_FLAG) && + !is_timestamp_type(sql_field->sql_type)) + { + sql_field->flags|= NO_DEFAULT_VALUE_FLAG; + sql_field->pack_flag|= FIELDFLAG_NO_DEFAULT; + } + if (thd->variables.sql_mode & MODE_NO_ZERO_DATE && !sql_field->def && is_timestamp_type(sql_field->sql_type) && |