mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
Having maybe_null flag unset for geometry/spatial functions leads to wrong Item_func_isnull::val_int()'s results. Fix: set maybe_null flag and add is_null() methods. mysql-test/r/gis.result: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test result. mysql-test/t/gis.test: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test case. sql/item_geofunc.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for Item_geometry_func and Item_func_as_wkt. - moved length check to the beginnig of the Item_func_spatial_collection::val_str() to affect geometry collection objects at once. - changed Item_func_isempty::val_int() and Item_func_issimple::val_int() to properly handle null_value. sql/item_geofunc.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for geometry/spatial functions. - added is_null() to Item_geometry_func and Item_func_spatial_rel classes. sql/spatial.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error. sql/spatial.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error.
This commit is contained in:
@@ -377,4 +377,38 @@ load data infile '../../std_data/bad_gis_data.dat' into table t1;
|
||||
alter table t1 enable keys;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
#
|
||||
# Bug #26038: is null and bad data
|
||||
#
|
||||
|
||||
create table t1 (a int, b blob);
|
||||
insert into t1 values (1, ''), (2, NULL), (3, '1');
|
||||
select * from t1;
|
||||
|
||||
select
|
||||
geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL,
|
||||
aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL,
|
||||
envelope(b) IS NULL, startpoint(b) IS NULL, endpoint(b) IS NULL,
|
||||
exteriorring(b) IS NULL, pointn(b, 1) IS NULL, geometryn(b, 1) IS NULL,
|
||||
interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, isempty(b) IS NULL,
|
||||
issimple(b) IS NULL, isclosed(b) IS NULL, dimension(b) IS NULL,
|
||||
numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL,
|
||||
area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL,
|
||||
y(b) IS NULL
|
||||
from t1;
|
||||
|
||||
select
|
||||
within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL,
|
||||
equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL,
|
||||
intersects(b, b) IS NULL, crosses(b, b) IS NULL
|
||||
from t1;
|
||||
|
||||
select
|
||||
point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL,
|
||||
multilinestring(b) IS NULL, multipolygon(b) IS NULL,
|
||||
geometrycollection(b) IS NULL
|
||||
from t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
Reference in New Issue
Block a user