diff options
author | unknown <gkodinov/kgeorge@magare.gmz> | 2007-03-14 12:20:34 +0200 |
---|---|---|
committer | unknown <gkodinov/kgeorge@magare.gmz> | 2007-03-14 12:20:34 +0200 |
commit | 6e10a2048d6f022e0aaa65944c6cdd986977ba54 (patch) | |
tree | 79217d5d4fe5f7d4a1f7b80e7929e4bf20ea96b9 /sql/sql_table.cc | |
parent | d92106135d19e6d7f3031546e9778b3bbba1ea42 (diff) | |
download | mariadb-git-6e10a2048d6f022e0aaa65944c6cdd986977ba54.tar.gz |
Bug #26794: 5.1 part
It was syntactically correct to define
spatial keys over parts of columns (e.g.
ALTER TABLE t1 ADD x GEOMETRY NOT NULL,
ADD SPATIAL KEY (x(32))).
This may lead to undefined results and/or
interpretation.
Fixed by not allowing partial column
specification in a SPATIAL index definition.
mysql-test/r/alter_table.result:
Bug #26794: 5.1 part
test case
mysql-test/r/gis-rtree.result:
Bug #26794: 5.1 part
updated the tests to the new syntax
mysql-test/t/alter_table.test:
Bug #26794: 5.1 part
test case
mysql-test/t/gis-rtree.test:
Bug #26794: 5.1 part
updated the tests to the new syntax
sql/sql_table.cc:
Bug #26794: 5.1 part
Disable defining SPATIAL KEYS with sub-key parts
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 177b568746a..328830f5db2 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2791,6 +2791,12 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, { column->length*= sql_field->charset->mbmaxlen; + if (key->type == Key::SPATIAL && column->length) + { + my_error(ER_WRONG_SUB_KEY, MYF(0)); + DBUG_RETURN(-1); + } + if (f_is_blob(sql_field->pack_flag) || (f_is_geom(sql_field->pack_flag) && key->type != Key::SPATIAL)) { @@ -5861,6 +5867,8 @@ view_err: if (!Field::type_can_have_key_part(cfield->field->type()) || (!Field::type_can_have_key_part(cfield->sql_type) && !f_is_geom (cfield->pack_flag)) || + /* spatial keys can't have sub-key length */ + (key_info->flags & HA_SPATIAL) || (cfield->field->field_length == key_part_length && !f_is_blob(key_part->key_type)) || (cfield->length && (cfield->length < key_part_length / |