summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2006-02-01 16:46:44 +0100
committerunknown <ingo@mysql.com>2006-02-01 16:46:44 +0100
commit08394605dcab41c0c940f6b0b461e36dc8ef2f6b (patch)
tree97ec6b284127a33d051ab58520ac01a6dd0b1650 /sql/sql_table.cc
parentae951e0f72bb3474eaaa282342f17b645d64ac87 (diff)
downloadmariadb-git-08394605dcab41c0c940f6b0b461e36dc8ef2f6b.tar.gz
Bug#8841 - CHECKSUM TABLE is broken in MyISAM
There are (at least) two implementations of the checksum computation. One is in MyISAM for the quick checksum. It is executed on every row change. The other is in the SQL layer for the extended checksum. It retrieves all rows of a table via the respective storage engine. In former MySQL versions varchars were stored with their maximum length, but now with their real length similar to blobs. This change had been forgotten to take care of in the extended checksum calculation. Hence too much data was checksumed. In MyISAM this change had been taken care of already. Only the real data is included in the checksum. I changed mysql_checksum_table() so that it uses the length information of true varchar fields instead of the field length like in former varchar implementations. mysql-test/r/innodb.result: Bug#8841 - CHECKSUM TABLE is broken in MyISAM Fixed test results. mysql-test/r/myisam.result: Bug#8841 - CHECKSUM TABLE is broken in MyISAM Fixed test results. sql/sql_table.cc: Bug#8841 - CHECKSUM TABLE is broken in MyISAM Changed mysql_checksum_table() so that it uses the length information of true varchar fields instead of the field length like in former varchar implementations.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index b1a24543a6b..3c6ca618107 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4218,7 +4218,8 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
for (uint i= 0; i < t->s->fields; i++ )
{
Field *f= t->field[i];
- if (f->type() == FIELD_TYPE_BLOB)
+ if ((f->type() == FIELD_TYPE_BLOB) ||
+ (f->type() == MYSQL_TYPE_VARCHAR))
{
String tmp;
f->val_str(&tmp);