﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28380	Wrong handling of NULL values in spatialite geometry comparison functions	Fabian Schindler	nobody	"For several geometry comparison functions (e.g: `ST_Intersects`, `ST_Equals`, ...) the [http://www.gaia-gis.it/spatialite-2.4.0/spatialite-sql-2.4.html spatialite documentation] states that

> The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and –1 for UNKNOWN corresponding to a function invocation on NULL arguments.

Unfortunately, the `-1` value is not handled separately, so (e.g:) `intersection` filters will include database records where the geometry is NULL.

A fix would be to change the lookup from:

{{{
...
WHERE Intersects(""modelname"".""fieldname"", GeomFromText('...',4326));
}}}

to


{{{
...
WHERE Intersects(""modelname"".""fieldname"", GeomFromText('...',4326)) > 0;
}}}
"	Bug	closed	GIS	1.11	Normal	fixed	spatialite geometry		Accepted	1	0	0	1	0	0
