Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-03-12 16:57:00+02:00, gkodinov@stripped +6 -0
Bug #26794:
Different set of conditions is used to verify
the validity of index definitions over a GEOMETRY
column in ALTER TABLE and CREATE TABLE.
The difference was on how sub-keys notion validity
is checked.
Fixed by extending the CREATE TABLE condition to
support the cases allowed in ALTER TABLE.
Made the SHOW CREATE TABLE not to display spatial
indexes using the sub-key notion.
mysql-test/r/alter_table.result@stripped, 2007-03-12 16:56:58+02:00, gkodinov@stripped +34
-0
Bug #26794: test case
mysql-test/r/gis-rtree.result@stripped, 2007-03-12 16:56:58+02:00, gkodinov@stripped +2 -2
Bug #26794: fixed SHOW CREATE TABLE output.
mysql-test/t/alter_table.test@stripped, 2007-03-12 16:56:58+02:00, gkodinov@stripped +23
-0
Bug #26794: test case
sql/field.cc@stripped, 2007-03-12 16:56:58+02:00, gkodinov@stripped +1 -0
Bug #26794: Allow sub-keys for GEOMETRY
sql/sql_show.cc@stripped, 2007-03-12 16:56:58+02:00, gkodinov@stripped +1 -1
Bug #26794: Don't show sub-key notion
in SHOW CREATE TABLE for SPATIAL indexes.
sql/sql_table.cc@stripped, 2007-03-12 16:56:59+02:00, gkodinov@stripped +3 -1
Bug #26794: Allow sub-keys for GEOMETRY
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gkodinov
# Host: magare.gmz
# Root: /home/kgeorge/mysql/work/B26794-5.0-opt
--- 1.339/sql/field.cc 2007-02-21 13:04:59 +02:00
+++ 1.340/sql/field.cc 2007-03-12 16:56:58 +02:00
@@ -1011,6 +1011,7 @@ bool Field::type_can_have_key_part(enum
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
+ case MYSQL_TYPE_GEOMETRY:
return TRUE;
default:
return FALSE;
--- 1.341/sql/sql_show.cc 2007-02-22 16:59:55 +02:00
+++ 1.342/sql/sql_show.cc 2007-03-12 16:56:58 +02:00
@@ -992,7 +992,7 @@ store_create_info(THD *thd, TABLE_LIST *
if (key_part->field &&
(key_part->length !=
table->field[key_part->fieldnr-1]->key_length() &&
- !(key_info->flags & HA_FULLTEXT)))
+ !(key_info->flags & (HA_FULLTEXT | HA_SPATIAL))))
{
buff[0] = '(';
char* end=int10_to_str((long) key_part->length /
--- 1.333/sql/sql_table.cc 2007-02-21 13:05:03 +02:00
+++ 1.334/sql/sql_table.cc 2007-03-12 16:56:59 +02:00
@@ -1344,6 +1344,7 @@ static int mysql_prepare_table(THD *thd,
}
else if (!f_is_geom(sql_field->pack_flag) &&
(column->length > length ||
+ !Field::type_can_have_key_part (sql_field->sql_type) ||
((f_is_packed(sql_field->pack_flag) ||
((file->table_flags() & HA_NO_PREFIX_CHAR_KEYS) &&
(key_info->flags & HA_NOSAME))) &&
@@ -3470,7 +3471,8 @@ view_err:
checking whether cfield->length < key_part_length (in chars).
*/
if (!Field::type_can_have_key_part(cfield->field->type()) ||
- !Field::type_can_have_key_part(cfield->sql_type) ||
+ (!Field::type_can_have_key_part(cfield->sql_type) &&
+ !f_is_geom (cfield->pack_flag)) ||
(cfield->field->field_length == key_part_length &&
!f_is_blob(key_part->key_type)) ||
(cfield->length && (cfield->length < key_part_length /
--- 1.62/mysql-test/r/alter_table.result 2007-01-19 03:37:49 +02:00
+++ 1.63/mysql-test/r/alter_table.result 2007-03-12 16:56:58 +02:00
@@ -826,3 +826,37 @@ create table t1 (t varchar(255) default
engine=myisam default charset=latin1;
alter table t1 change t t text;
drop table t1;
+CREATE TABLE t1 (a varchar(500));
+ALTER TABLE t1 ADD b GEOMETRY NOT NULL, ADD SPATIAL INDEX(b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(500) default NULL,
+ `b` geometry NOT NULL,
+ SPATIAL KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 ADD KEY(b(50));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(500) default NULL,
+ `b` geometry NOT NULL,
+ SPATIAL KEY `b` (`b`),
+ KEY `b_2` (`b`(50))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 ADD c POINT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(500) default NULL,
+ `b` geometry NOT NULL,
+ `c` point default NULL,
+ SPATIAL KEY `b` (`b`),
+ KEY `b_2` (`b`(50))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+CREATE TABLE t2 (a INT, KEY (a(20)));
+ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is
longer than the key part, or the storage engine doesn't support unique sub keys
+ALTER TABLE t1 ADD d INT;
+ALTER TABLE t1 ADD KEY (d(20));
+ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is
longer than the key part, or the storage engine doesn't support unique sub keys
+DROP TABLE t1;
--- 1.49/mysql-test/t/alter_table.test 2007-01-19 03:37:49 +02:00
+++ 1.50/mysql-test/t/alter_table.test 2007-03-12 16:56:58 +02:00
@@ -613,3 +613,26 @@ create table t1 (t varchar(255) default
engine=myisam default charset=latin1;
alter table t1 change t t text;
drop table t1;
+
+#
+# Bug #26794: Adding an index with a prefix on a SPATIAL type breaks ALTER
+# TABLE
+#
+CREATE TABLE t1 (a varchar(500));
+
+ALTER TABLE t1 ADD b GEOMETRY NOT NULL, ADD SPATIAL INDEX(b);
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ADD KEY(b(50));
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 ADD c POINT;
+SHOW CREATE TABLE t1;
+
+--error ER_WRONG_SUB_KEY
+CREATE TABLE t2 (a INT, KEY (a(20)));
+
+ALTER TABLE t1 ADD d INT;
+--error ER_WRONG_SUB_KEY
+ALTER TABLE t1 ADD KEY (d(20));
+
+DROP TABLE t1;
--- 1.23/mysql-test/r/gis-rtree.result 2006-12-19 15:04:20 +02:00
+++ 1.24/mysql-test/r/gis-rtree.result 2007-03-12 16:56:58 +02:00
@@ -10,7 +10,7 @@ t1 CREATE TABLE `t1` (
`fid` int(11) NOT NULL auto_increment,
`g` geometry NOT NULL,
PRIMARY KEY (`fid`),
- SPATIAL KEY `g` (`g`(32))
+ SPATIAL KEY `g` (`g`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)'));
@@ -293,7 +293,7 @@ t2 CREATE TABLE `t2` (
`fid` int(11) NOT NULL auto_increment,
`g` geometry NOT NULL,
PRIMARY KEY (`fid`),
- SPATIAL KEY `g` (`g`(32))
+ SPATIAL KEY `g` (`g`)
) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1
SELECT count(*) FROM t2;
count(*)
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2434) BUG#26794 | kgeorge | 12 Mar |