summaryrefslogtreecommitdiff
path: root/sql/sql_update.h
diff options
context:
space:
mode:
authorMartin Hansson <martin.hansson@oracle.com>2010-10-07 12:01:51 +0200
committerMartin Hansson <martin.hansson@oracle.com>2010-10-07 12:01:51 +0200
commit95f8d9a2a4fdb84c652ec46857948b19eac9f274 (patch)
tree2a344417f8413f6ae60f68b12c566ef9557b0251 /sql/sql_update.h
parent9c7bd5146ed5315a44eea167fe86487357074fd7 (diff)
downloadmariadb-git-95f8d9a2a4fdb84c652ec46857948b19eac9f274.tar.gz
Bug#56423: Different count with SELECT and CREATE SELECT queries
This is the 5.5 version of the fix. The 5.1 version was too complicated to merge and was null merged. This is a regression from the fix for bug no 38999. A storage engine capable of reading only a subset of a table's columns updates corresponding bits in the read buffer to signal that it has read NULL values for the corresponding columns. It cannot, and should not, update any other bits. Bug no 38999 occurred because the implementation of UPDATE statements compare the NULL bits using memcmp, inadvertently comparing bits that were never requested from the storage engine. The regression was caused by the storage engine trying to alleviate the situation by writing to all NULL bits, even those that it had no knowledge of. This has devastating effects for the index merge algorithm, which relies on all NULL bits, except those explicitly requested, being left unchanged. The fix reverts the fix for bug no 38999 in both InnoDB and InnoDB plugin and changes the server's method of comparing records. For engines that always read entire rows, we proceed as usual. For engines capable of reading only select columns, the record buffers are now compared on a column by column basis. An assertion was also added so that non comparable buffers are never read. Some relevant copy-pasted code was also consolidated in a new function.
Diffstat (limited to 'sql/sql_update.h')
-rw-r--r--sql/sql_update.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_update.h b/sql/sql_update.h
index 6bf022a171c..50ff50f025d 100644
--- a/sql/sql_update.h
+++ b/sql/sql_update.h
@@ -38,6 +38,7 @@ bool mysql_multi_update(THD *thd, TABLE_LIST *table_list,
enum enum_duplicates handle_duplicates, bool ignore,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex,
multi_update **result);
-bool compare_record(TABLE *table);
+bool records_are_comparable(const TABLE *table);
+bool compare_records(const TABLE *table);
#endif /* SQL_UPDATE_INCLUDED */