Commit 96f4a906 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns

parent aaf6334b
...@@ -1816,3 +1816,15 @@ disjoint ...@@ -1816,3 +1816,15 @@ disjoint
select ST_IsRing(NULL); select ST_IsRing(NULL);
ST_IsRing(NULL) ST_IsRing(NULL)
-1 -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;
...@@ -1518,3 +1518,10 @@ select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),' ...@@ -1518,3 +1518,10 @@ select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'
select ST_IsRing(NULL); 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;
...@@ -287,7 +287,9 @@ protected: ...@@ -287,7 +287,9 @@ protected:
public: public:
Item_func_spatial_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel): Item_func_spatial_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
Item_bool_func2(thd, a, b), spatial_rel(sp_rel) Item_bool_func2(thd, a, b), spatial_rel(sp_rel)
{ } {
maybe_null= true;
}
enum Functype functype() const { return spatial_rel; } enum Functype functype() const { return spatial_rel; }
enum Functype rev_functype() const { return spatial_rel; } enum Functype rev_functype() const { return spatial_rel; }
bool is_null() { (void) val_int(); return null_value; } bool is_null() { (void) val_int(); return null_value; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment