Skip to content

Commit 9924093

Browse files
author
Alexander Barkov
committed
Bug#14140927 IS_EQUALS() IS BOGUS FOR FIELD_GEOM, HURTING IN-PLACE ALTER
Problem: IN-PLACE ALTER TABLE did not work for tables having at least one GEOMETRY column: Field_geom::is_equal() was missing, so the inherited Field_blob::is_equal() was called for GEOMETRY columns, which never returned "true". Fix: implementing a proper is_equal() for Field_geom.
1 parent 4121ba8 commit 9924093

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

sql/field.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8236,6 +8236,17 @@ Field_geom::store(const char *from, uint length, const CHARSET_INFO *cs)
82368236
return TYPE_ERR_BAD_VALUE;
82378237
}
82388238

8239+
8240+
uint Field_geom::is_equal(Create_field *new_field)
8241+
{
8242+
return new_field->field_flags_are_binary() == field_flags_are_binary() &&
8243+
new_field->sql_type == real_type() &&
8244+
new_field->geom_type == get_geometry_type() &&
8245+
new_field->charset == field_charset &&
8246+
new_field->pack_length == pack_length();
8247+
}
8248+
8249+
82398250
#endif /*HAVE_SPATIAL*/
82408251

82418252
/****************************************************************************

sql/field.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,6 +3473,7 @@ class Field_geom :public Field_blob {
34733473
DBUG_ASSERT(type() == MYSQL_TYPE_GEOMETRY);
34743474
return new Field_geom(*this);
34753475
}
3476+
uint is_equal(Create_field *new_field);
34763477
};
34773478
#endif /*HAVE_SPATIAL*/
34783479

0 commit comments

Comments
 (0)