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-28 14:35:23+03:00, gkodinov@stripped +4 -0
Bug #27300:
Geometry fields have a result type string and a
special subclass to cater for the differences
between them and the base class (just like
DATE/TIME).
When creating temporary tables for results of
functions that return results of type GEOMETRY
we must construct fields of the derived class
instead of the base class.
Fixed by creating a GEOMETRY field (Field_geom)
instead of a generic BLOB (Field_blob) in temp
tables for the results of GIS functions that
have GEOMETRY return type (Item_geometry_func).
mysql-test/r/gis.result@stripped, 2007-03-28 14:35:22+03:00, gkodinov@stripped +11 -0
Bug #27300: test case
mysql-test/t/gis.test@stripped, 2007-03-28 14:35:22+03:00, gkodinov@stripped +11 -0
Bug #27300: test case
sql/item.cc@stripped, 2007-03-28 14:35:22+03:00, gkodinov@stripped +4 -1
Bug #27300:
Create a GEOMETRY field (Field_geom) instead of
a generic BLOB (Field_blob) in temp tables for
the results of GIS functions (Item_geometry_func).
sql/sql_select.cc@stripped, 2007-03-28 14:35:22+03:00, gkodinov@stripped +3 -3
Bug #27300:
Create a GEOMETRY field (Field_geom) instead of
a generic BLOB (Field_blob) in temp tables for
the results of GIS functions (Item_geometry_func).
# 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/B27300-5.0-opt
--- 1.259/sql/item.cc 2007-03-22 23:51:14 +02:00
+++ 1.260/sql/item.cc 2007-03-28 14:35:22 +03:00
@@ -4275,7 +4275,6 @@ Field *Item::tmp_table_field_from_field_
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_GEOMETRY:
if (this->type() == Item::TYPE_HOLDER)
return new Field_blob(max_length, maybe_null, name, table,
collation.collation, 1);
@@ -4283,6 +4282,10 @@ Field *Item::tmp_table_field_from_field_
return new Field_blob(max_length, maybe_null, name, table,
collation.collation);
break; // Blob handled outside of case
+ case MYSQL_TYPE_GEOMETRY:
+ return new Field_geom(max_length, maybe_null, name, table,
+ (Field::geometry_type)
+ ((Item_geometry_func *)this)->get_geometry_type());
}
}
--- 1.502/sql/sql_select.cc 2007-03-26 09:44:03 +03:00
+++ 1.503/sql/sql_select.cc 2007-03-28 14:35:22 +03:00
@@ -8793,12 +8793,12 @@ static Field *create_tmp_field_from_item
enum enum_field_types type;
/*
- DATE/TIME fields have STRING_RESULT result type. To preserve
- type they needed to be handled separately.
+ DATE/TIME and GEOMETRY fields have STRING_RESULT result type.
+ To preserve type they needed to be handled separately.
*/
if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE ||
- type == MYSQL_TYPE_TIMESTAMP)
+ type == MYSQL_TYPE_TIMESTAMP || type == MYSQL_TYPE_GEOMETRY)
new_field= item->tmp_table_field_from_field_type(table);
/*
Make sure that the blob fits into a Field_varstring which has
--- 1.42/mysql-test/r/gis.result 2007-03-26 14:14:21 +03:00
+++ 1.43/mysql-test/r/gis.result 2007-03-28 14:35:22 +03:00
@@ -769,3 +769,14 @@ create table t1 (g geometry not null);
insert into t1 values(default);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
+CREATE TABLE t1 (a GEOMETRY);
+CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
+CREATE VIEW v2 AS SELECT a FROM t1;
+DESCRIBE v1;
+Field Type Null Key Default Extra
+GeomFromwkb(ASBINARY(a)) geometry YES NULL
+DESCRIBE v2;
+Field Type Null Key Default Extra
+a geometry YES NULL
+DROP VIEW v1,v2;
+DROP TABLE t1;
--- 1.35/mysql-test/t/gis.test 2007-03-26 14:09:40 +03:00
+++ 1.36/mysql-test/t/gis.test 2007-03-28 14:35:22 +03:00
@@ -479,3 +479,14 @@ create table t1 (g geometry not null);
insert into t1 values(default);
drop table t1;
+#
+# Bug #27300: create view with geometry functions lost columns types
+#
+CREATE TABLE t1 (a GEOMETRY);
+CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
+CREATE VIEW v2 AS SELECT a FROM t1;
+DESCRIBE v1;
+DESCRIBE v2;
+
+DROP VIEW v1,v2;
+DROP TABLE t1;
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2422) BUG#27300 | kgeorge | 28 Mar |