summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorKristofer Pettersson <kristofer.pettersson@sun.com>2009-09-21 11:58:15 +0200
committerKristofer Pettersson <kristofer.pettersson@sun.com>2009-09-21 11:58:15 +0200
commit5ec6043ac37380fac2cbcbc15e4f2e8b76653f15 (patch)
treed16567c0bf617b0c6f38d72f0d48e561ab3ae8b5 /sql/sql_table.cc
parent5080092322817d76c0962f196dc967867e07b20d (diff)
downloadmariadb-git-5ec6043ac37380fac2cbcbc15e4f2e8b76653f15.tar.gz
Fix for BUG#35570 "CHECKSUM TABLE unreliable if LINESTRING field (same content/ differen
checksum)" The problem was that checksum of GEOMETRY type used memory addresses in the computation, making it un-repeatable thus useless. (This patch is a backport from 6.0 branch) mysql-test/r/myisam.result: test case for bug35570 that same tables give same checksums mysql-test/t/myisam.test: test case for bug35570 that same tables give same checksums sql/sql_table.cc: Type GEOMETRY is implemented on top of type BLOB, so, just like for BLOB, its 'field' contains pointers which it does not make sense to include in the checksum; it rather has to be converted to a string and then we can compute the checksum.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 9d929c0d1a3..08f3311be9d 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -7897,8 +7897,14 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
for (uint i= 0; i < t->s->fields; i++ )
{
Field *f= t->field[i];
- if ((f->type() == MYSQL_TYPE_BLOB) ||
- (f->type() == MYSQL_TYPE_VARCHAR))
+ enum_field_types field_type= f->type();
+ /*
+ BLOB and VARCHAR have pointers in their field, we must convert
+ to string; GEOMETRY is implemented on top of BLOB.
+ */
+ if ((field_type == MYSQL_TYPE_BLOB) ||
+ (field_type == MYSQL_TYPE_VARCHAR) ||
+ (field_type == MYSQL_TYPE_GEOMETRY))
{
String tmp;
f->val_str(&tmp);