mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#28763: Selecting geometry fields in UNION caused server crash.
This bug was introduced by the fix for the bug#27300. In this fix a section of code was added to the Item::tmp_table_field_from_field_type method. This section intended to create Field_geom fields for the Item_geometry_func class and its descendants. In order to get the geometry type of the current item it casted "this" to the Item_geometry_func* type. But the Item::tmp_table_field_from_field_type method is also used for creation of fields for UNION and in this case this method is called for an object of the Item_type_holder class and the cast to the Item_geometry_func* type causes a server crash. Now the Item::tmp_table_field_from_field_type method correctly works when it's called for both the Item_type_holder and the Item_geometry_func classes. The new geometry_type variable is added to the Item_type_holder class. The new method called get_geometry_type is added to the Item_field and the Field classes. It returns geometry type from the field for the Item_field and the Field_geom classes and fails an assert for other Field descendants. sql/field.h: Bug#28763: Selecting geometry fields in UNION caused server crash. The new method called get_geometry_type is added to the Field class. It returns geometry type of the field for the Field_geom class and fails an assert for other Field descendants. sql/item.cc: Bug#28763: Selecting geometry fields in UNION caused server crash. Now the Item::tmp_table_field_from_field_type method correctly works when it's called for both the Item_type_holder and the Item_geometry_func classes. mysql-test/r/gis.result: Added a test case for the bug#28763: Selecting geometry fields in UNION caused server crash. mysql-test/t/gis.test: Added a test case for the bug#28763: Selecting geometry fields in UNION caused server crash. sql/item.h: Bug#28763: Selecting geometry fields in UNION caused server crash. The new method called get_geometry_type is added to the Item_field class. It returns geometry type from the field. The new geometry_type variable is added to the Item_type_holder class.
This commit is contained in:
@ -864,4 +864,25 @@ SELECT Overlaps(@horiz1, @point2) FROM DUAL;
|
||||
Overlaps(@horiz1, @point2)
|
||||
0
|
||||
DROP TABLE t1;
|
||||
create table t1(f1 geometry, f2 point, f3 linestring);
|
||||
select f1 from t1 union select f1 from t1;
|
||||
f1
|
||||
insert into t1 (f2,f3) values (GeomFromText('POINT(1 1)'),
|
||||
GeomFromText('LINESTRING(0 0,1 1,2 2)'));
|
||||
select AsText(f2),AsText(f3) from t1;
|
||||
AsText(f2) AsText(f3)
|
||||
POINT(1 1) LINESTRING(0 0,1 1,2 2)
|
||||
select AsText(a) from (select f2 as a from t1 union select f3 from t1) t;
|
||||
AsText(a)
|
||||
POINT(1 1)
|
||||
LINESTRING(0 0,1 1,2 2)
|
||||
create table t2 as select f2 as a from t1 union select f3 from t1;
|
||||
desc t2;
|
||||
Field Type Null Key Default Extra
|
||||
a point YES NULL
|
||||
select AsText(a) from t2;
|
||||
AsText(a)
|
||||
POINT(1 1)
|
||||
LINESTRING(0 0,1 1,2 2)
|
||||
drop table t1, t2;
|
||||
End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user