diff options
author | unknown <hf@deer.(none)> | 2005-10-25 19:08:33 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2005-10-25 19:08:33 +0500 |
commit | eba555b3f60789952fd589c36387543c187d383a (patch) | |
tree | e9b843eb17c17ebcfc9959e9c638b4c0dd2bb040 | |
parent | 10a889a577e1a09f29922ba20d7e8ad96449bb04 (diff) | |
parent | c2b9856333492cb0cec495f50c884be92b75c918 (diff) | |
download | mariadb-git-eba555b3f60789952fd589c36387543c187d383a.tar.gz |
Merge bk@192.168.21.1:/usr/home/bk/mysql-5.0
into deer.(none):/home/hf/work/mysql-5.0.12267
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
-rw-r--r-- | mysql-test/r/gis.result | 8 | ||||
-rw-r--r-- | mysql-test/t/gis.test | 11 | ||||
-rw-r--r-- | sql/sql_table.cc | 6 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 4 |
4 files changed, 27 insertions, 2 deletions
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 78014137b50..90857ecfc6d 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -680,3 +680,11 @@ select astext(fn3()); astext(fn3()) POINT(1 1) drop function fn3; +create table t1(pt POINT); +alter table t1 add primary key pti(pt); +drop table t1; +create table t1(pt GEOMETRY); +alter table t1 add primary key pti(pt); +ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length +alter table t1 add primary key pti(pt(20)); +drop table t1; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index aba2f33833a..142bd29fa2d 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -395,3 +395,14 @@ show create function fn3; select astext(fn3()); drop function fn3; +# +# Bug #12267 (primary key over GIS) +# +create table t1(pt POINT); +alter table t1 add primary key pti(pt); +drop table t1; +create table t1(pt GEOMETRY); +--error 1170 +alter table t1 add primary key pti(pt); +alter table t1 add primary key pti(pt(20)); +drop table t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1e96891113b..56a55d9fbc0 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1149,13 +1149,17 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, { column->length*= sql_field->charset->mbmaxlen; - if (f_is_blob(sql_field->pack_flag)) + if (f_is_blob(sql_field->pack_flag) || + (f_is_geom(sql_field->pack_flag) && key->type != Key::SPATIAL)) { if (!(file->table_flags() & HA_CAN_INDEX_BLOBS)) { my_error(ER_BLOB_USED_AS_KEY, MYF(0), column->field_name); DBUG_RETURN(-1); } + if (f_is_geom(sql_field->pack_flag) && sql_field->geom_type == + Field::GEOM_POINT) + column->length= 21; if (!column->length) { my_error(ER_BLOB_KEY_WITHOUT_LENGTH, MYF(0), column->field_name); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b9cfb4a62f1..b2dffad4fb3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2970,7 +2970,9 @@ type: spatial_type: GEOMETRY_SYM { $$= Field::GEOM_GEOMETRY; } | GEOMETRYCOLLECTION { $$= Field::GEOM_GEOMETRYCOLLECTION; } - | POINT_SYM { $$= Field::GEOM_POINT; } + | POINT_SYM { Lex->length= (char*)"21"; + $$= Field::GEOM_POINT; + } | MULTIPOINT { $$= Field::GEOM_MULTIPOINT; } | LINESTRING { $$= Field::GEOM_LINESTRING; } | MULTILINESTRING { $$= Field::GEOM_MULTILINESTRING; } |