diff options
author | Ingo Struewing <ingo.struewing@sun.com> | 2008-11-27 16:28:50 +0100 |
---|---|---|
committer | Ingo Struewing <ingo.struewing@sun.com> | 2008-11-27 16:28:50 +0100 |
commit | 7bfc13296f9db0e0c0cd33eff51dca8a7093168b (patch) | |
tree | d7bf5c7e61997a4b9af3607b31985d08064c3295 /sql | |
parent | 41494f86f446580aab3c15884fc27370d7133b16 (diff) | |
parent | 0385618e0575277a026ea2dbe0a15fd33a0bc267 (diff) | |
download | mariadb-git-7bfc13296f9db0e0c0cd33eff51dca8a7093168b.tar.gz |
merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 2 | ||||
-rw-r--r-- | sql/mysql_priv.h | 1 | ||||
-rw-r--r-- | sql/sql_base.cc | 3 | ||||
-rw-r--r-- | sql/sql_update.cc | 26 |
4 files changed, 32 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc index a03beb4e8af..e815320bc9e 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5814,6 +5814,7 @@ int Field_newdate::store_time(MYSQL_TIME *ltime,timestamp_type time_type) { char buff[MAX_DATE_STRING_REP_LENGTH]; String str(buff, sizeof(buff), &my_charset_latin1); + tmp= 0; make_date((DATE_TIME_FORMAT *) 0, ltime, &str); set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, str.ptr(), str.length(), MYSQL_TIMESTAMP_DATE, 1); @@ -6056,6 +6057,7 @@ int Field_datetime::store_time(MYSQL_TIME *ltime,timestamp_type time_type) { char buff[MAX_DATE_STRING_REP_LENGTH]; String str(buff, sizeof(buff), &my_charset_latin1); + tmp= 0; make_datetime((DATE_TIME_FORMAT *) 0, ltime, &str); set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, str.ptr(), str.length(), MYSQL_TIMESTAMP_DATETIME,1); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index d11f2838e3a..0816c371ee8 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -548,6 +548,7 @@ protected: #define UNCACHEABLE_PREPARE 16 /* For uncorrelated SELECT in an UNION with some correlated SELECTs */ #define UNCACHEABLE_UNITED 32 +#define UNCACHEABLE_CHECKOPTION 64 /* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */ #define UNDEF_POS (-1) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index d7bb571b8c7..6dcd11fac71 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3095,7 +3095,10 @@ bool reopen_table(TABLE *table) for (key=0 ; key < table->s->keys ; key++) { for (part=0 ; part < table->key_info[key].usable_key_parts ; part++) + { table->key_info[key].key_part[part].field->table= table; + table->key_info[key].key_part[part].field->orig_table= table; + } } if (table->triggers) table->triggers->set_table(table); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 197e5290aba..4fbf08c44d3 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1470,6 +1470,32 @@ multi_update::initialize_tables(JOIN *join) } table->prepare_for_position(); + /* + enable uncacheable flag if we update a view with check option + and check option has a subselect, otherwise, the check option + can be evaluated after the subselect was freed as independent + (See full_local in JOIN::join_free()). + */ + if (table_ref->check_option && !join->select_lex->uncacheable) + { + SELECT_LEX_UNIT *tmp_unit; + SELECT_LEX *sl; + for (tmp_unit= join->select_lex->first_inner_unit(); + tmp_unit; + tmp_unit= tmp_unit->next_unit()) + { + for (sl= tmp_unit->first_select(); sl; sl= sl->next_select()) + { + if (sl->master_unit()->item) + { + join->select_lex->uncacheable|= UNCACHEABLE_CHECKOPTION; + goto loop_end; + } + } + } + } +loop_end: + if (table == first_table_for_update && table_ref->check_option) { table_map unupdated_tables= table_ref->check_option->used_tables() & |