mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Bug#50574 5.5.x allows spatial indexes on non-spatial columns,
causing crashes!
Adding a SPATIAL INDEX on a non-geometrical column caused a
segmentation fault when the table was subsequently
inserted into.
A test was added in mysql_prepare_create_table to explicitly
check whether non-geometrical columns are used in a
spatial index, and throw an error if so.
mysql-test/t/gis.test:
Added test cases to verify that only geometrical
columns can get a spatial index.
In addition, verify that only a single geom.
column can participate in a spatial index.
This commit is contained in:
@@ -3193,11 +3193,19 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
{
|
||||
column->length*= sql_field->charset->mbmaxlen;
|
||||
|
||||
if (key->type == Key::SPATIAL && column->length)
|
||||
if (key->type == Key::SPATIAL)
|
||||
{
|
||||
my_error(ER_WRONG_SUB_KEY, MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (column->length)
|
||||
{
|
||||
my_error(ER_WRONG_SUB_KEY, MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (!f_is_geom(sql_field->pack_flag))
|
||||
{
|
||||
my_error(ER_SPATIAL_MUST_HAVE_GEOM_COL, MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (f_is_blob(sql_field->pack_flag) ||
|
||||
(f_is_geom(sql_field->pack_flag) && key->type != Key::SPATIAL))
|
||||
|
||||
Reference in New Issue
Block a user