diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2006-02-08 18:08:18 +0100 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2006-02-08 18:08:18 +0100 |
commit | 39b792908f3c0da3150ac6700a5c1f8b8e6eec76 (patch) | |
tree | 7575fb0985c3822222a6b13860e48f8801fd66ab /sql/sql_base.cc | |
parent | 2569b61cc2d77ce010db86dbb9299a2e29bc0b63 (diff) | |
download | mariadb-git-39b792908f3c0da3150ac6700a5c1f8b8e6eec76.tar.gz |
Bug #17206 Update through VIEW is not working
mysql-test/r/ndb_view.result:
New BitKeeper file ``mysql-test/r/ndb_view.result''
mysql-test/t/ndb_view.test:
New BitKeeper file ``mysql-test/t/ndb_view.test''
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 44b3a22ec52..44aed586928 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3858,13 +3858,31 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list, register_tree_change, actual_table); } + if (fld) + { #ifndef NO_EMBEDDED_ACCESS_CHECKS - /* Check if there are sufficient access rights to the found field. */ - if (fld && check_privileges && - check_column_grant_in_table_ref(thd, *actual_table, name, length)) - fld= WRONG_GRANT; + /* Check if there are sufficient access rights to the found field. */ + if (check_privileges && + check_column_grant_in_table_ref(thd, *actual_table, name, length)) + fld= WRONG_GRANT; + else #endif - + if (thd->set_query_id) + { + Field *field_to_set= NULL; + if (fld == view_ref_found) + { + Item *it= (*ref)->real_item(); + if (it->type() == Item::FIELD_ITEM) + field_to_set= ((Item_field*)it)->field; + } + else + field_to_set= fld; + if (field_to_set) + field_to_set->table->file->ha_set_bit_in_rw_set(field_to_set->fieldnr, + (bool)(thd->set_query_id-1)); + } + } DBUG_RETURN(fld); } @@ -5044,6 +5062,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, DBUG_ENTER("setup_fields"); thd->set_query_id=set_query_id; + DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id)); if (allow_sum_func) thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level; thd->where= THD::DEFAULT_WHERE; @@ -5070,6 +5089,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, { thd->lex->allow_sum_func= save_allow_sum_func; thd->set_query_id= save_set_query_id; + DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id)); DBUG_RETURN(TRUE); /* purecov: inspected */ } if (ref) @@ -5081,6 +5101,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, } thd->lex->allow_sum_func= save_allow_sum_func; thd->set_query_id= save_set_query_id; + DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id)); DBUG_RETURN(test(thd->net.report_error)); } @@ -5527,6 +5548,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, arena= 0; // For easier test thd->set_query_id=1; + DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id)); select_lex->cond_count= 0; for (table= tables; table; table= table->next_local) |