summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2012-11-03 12:24:36 +0400
committerSergey Petrunya <psergey@askmonty.org>2012-11-03 12:24:36 +0400
commitbe0be7af47fcc75b798fcf7aa98dda9c7d31cc15 (patch)
tree6d47869d528e86fe4bcca67de31ae355e4959f18 /sql/sql_update.cc
parent40e94a3734b1daa254810c4be64e17b84dbbc2a2 (diff)
downloadmariadb-git-be0be7af47fcc75b798fcf7aa98dda9c7d31cc15.tar.gz
# MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions
Reconcile the fixes from: # # guilhem.bichot@oracle.com-20110805143029-ywrzuz15uzgontr0 # Fix for BUG#12698916 - "JOIN QUERY GIVES WRONG RESULT AT 2ND EXEC. OR # AFTER FLUSH TABLES [-INT VS NULL]" # # guilhem.bichot@oracle.com-20111209150650-tzx3ldzxe1yfwji6 # Fix for BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == SAVE_READ_SET # and # and related fixes from: BUG#1006164, MDEV-376: Now, ROR-merged QUICK_RANGE_SELECT objects make no assumptions about the values of table->read_set and table->write_set. Each QUICK_ROR_SELECT has (and had before) its own column bitmap, but now, all QUICK_ROR_SELECT's functions that care: reset(), init_ror_merged_scan(), and get_next() will set table->read_set when invoked and restore it back to what it was before the call before they return. This allows to avoid the mess when somebody else modifies table->read_set for some reason.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 549e59329aa..d7ff610921f 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -480,12 +480,15 @@ int mysql_update(THD *thd,
We can't update table directly; We must first search after all
matching rows before updating the table!
*/
+
+ // Verify that table->restore_column_maps_after_mark_index() will work
+ DBUG_ASSERT(table->read_set == &table->def_read_set);
+ DBUG_ASSERT(table->write_set == &table->def_write_set);
+
if (used_index < MAX_KEY && old_covering_keys.is_set(used_index))
table->add_read_columns_used_by_index(used_index);
else
- {
table->use_all_columns();
- }
/* note: We avoid sorting if we sort on the used index */
if (order && (need_sort || used_key_is_modified))
@@ -619,8 +622,11 @@ int mysql_update(THD *thd,
if (error >= 0)
goto err;
}
- if (table->key_read)
- table->restore_column_maps_after_mark_index();
+ /*
+ This restore bitmaps, works for add_read_columns_used_by_index() and
+ use_all_columns():
+ */
+ table->restore_column_maps_after_mark_index();
}
if (ignore)