diff options
-rw-r--r-- | mysql-test/r/gis.result | 12 | ||||
-rw-r--r-- | mysql-test/t/gis.test | 7 | ||||
-rw-r--r-- | sql/item_geofunc.h | 4 |
3 files changed, 22 insertions, 1 deletions
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 0d8f30d125f..9e337f6b5aa 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1816,3 +1816,15 @@ disjoint select ST_IsRing(NULL); ST_IsRing(NULL) -1 +# +# MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns +# +CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL); +CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `w1` int(1) DEFAULT NULL, + `w2` int(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1,t2; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 60f12a355b4..18cfe95b749 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1518,3 +1518,10 @@ select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),' select ST_IsRing(NULL); +--echo # +--echo # MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns +--echo # +CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL); +CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1,t2; diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index b64360de394..d814019bd74 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -287,7 +287,9 @@ protected: public: Item_func_spatial_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel): Item_bool_func2(thd, a, b), spatial_rel(sp_rel) - { } + { + maybe_null= true; + } enum Functype functype() const { return spatial_rel; } enum Functype rev_functype() const { return spatial_rel; } bool is_null() { (void) val_int(); return null_value; } |