Skip to content

Commit 96f4a90

Browse files
author
Alexander Barkov
committed
MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns
1 parent aaf6334 commit 96f4a90

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

mysql-test/r/gis.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,3 +1816,15 @@ disjoint
18161816
select ST_IsRing(NULL);
18171817
ST_IsRing(NULL)
18181818
-1
1819+
#
1820+
# MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns
1821+
#
1822+
CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL);
1823+
CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1;
1824+
SHOW CREATE TABLE t2;
1825+
Table Create Table
1826+
t2 CREATE TABLE `t2` (
1827+
`w1` int(1) DEFAULT NULL,
1828+
`w2` int(1) DEFAULT NULL
1829+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1830+
DROP TABLE t1,t2;

mysql-test/t/gis.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,3 +1518,10 @@ select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'
15181518

15191519
select ST_IsRing(NULL);
15201520

1521+
--echo #
1522+
--echo # MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns
1523+
--echo #
1524+
CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL);
1525+
CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1;
1526+
SHOW CREATE TABLE t2;
1527+
DROP TABLE t1,t2;

sql/item_geofunc.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,9 @@ class Item_func_spatial_rel: public Item_bool_func2
287287
public:
288288
Item_func_spatial_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
289289
Item_bool_func2(thd, a, b), spatial_rel(sp_rel)
290-
{ }
290+
{
291+
maybe_null= true;
292+
}
291293
enum Functype functype() const { return spatial_rel; }
292294
enum Functype rev_functype() const { return spatial_rel; }
293295
bool is_null() { (void) val_int(); return null_value; }

0 commit comments

Comments
 (0)