[Django] #28380: Wrong handling of NULL values in spatialite geometry comparison functions

6 views
Skip to first unread message

Django

unread,
Jul 10, 2017, 3:24:22 AM7/10/17
to django-...@googlegroups.com
#28380: Wrong handling of NULL values in spatialite geometry comparison functions
-------------------------------------+-------------------------------------
Reporter: Fabian | Owner: nobody
Schindler |
Type: Bug | Status: new
Component: GIS | Version: 1.11
Severity: Normal | Keywords: spatialite geometry
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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;
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28380>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 10, 2017, 6:20:25 AM7/10/17
to django-...@googlegroups.com
#28380: Wrong handling of NULL values in spatialite geometry comparison functions
-------------------------------------+-------------------------------------
Reporter: Fabian Schindler | Owner: nobody

Type: Bug | Status: new
Component: GIS | Version: 1.11
Severity: Normal | Resolution:

Keywords: spatialite geometry | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Fabian Schindler):

PR: https://github.com/django/django/pull/8722

--
Ticket URL: <https://code.djangoproject.com/ticket/28380#comment:1>

Django

unread,
Jul 10, 2017, 8:04:31 AM7/10/17
to django-...@googlegroups.com
#28380: Wrong handling of NULL values in spatialite geometry comparison functions
-------------------------------------+------------------------------------
Reporter: Fabian Schindler | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 1.11
Severity: Normal | Resolution:
Keywords: spatialite geometry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Simon Charette):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* needs_tests: 0 => 1
* stage: Unreviewed => Accepted


Comment:

The patch needs adjustments as some tests are failing and some additional
regression tests would be required for the handling of `None` arguments.

--
Ticket URL: <https://code.djangoproject.com/ticket/28380#comment:2>

Django

unread,
Jul 10, 2017, 10:56:33 AM7/10/17
to django-...@googlegroups.com
#28380: Wrong handling of NULL values in spatialite geometry comparison functions
-------------------------------------+------------------------------------
Reporter: Fabian Schindler | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 1.11
Severity: Normal | Resolution:
Keywords: spatialite geometry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------

Comment (by Fabian Schindler):

New [https://github.com/django/django/pull/8725 PR] (old one was closed
because of wrong base)

--
Ticket URL: <https://code.djangoproject.com/ticket/28380#comment:3>

Django

unread,
Jul 21, 2017, 12:19:48 PM7/21/17
to django-...@googlegroups.com
#28380: Wrong handling of NULL values in spatialite geometry comparison functions
-------------------------------------+------------------------------------
Reporter: Fabian Schindler | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 1.11
Severity: Normal | Resolution:
Keywords: spatialite geometry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/28380#comment:4>

Django

unread,
Jul 24, 2017, 8:46:34 PM7/24/17
to django-...@googlegroups.com
#28380: Wrong handling of NULL values in spatialite geometry comparison functions
-------------------------------------+------------------------------------
Reporter: Fabian Schindler | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 1.11
Severity: Normal | Resolution:
Keywords: spatialite geometry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28380#comment:5>

Django

unread,
Aug 24, 2017, 8:49:59 AM8/24/17
to django-...@googlegroups.com
#28380: Wrong handling of NULL values in spatialite geometry comparison functions
-------------------------------------+------------------------------------
Reporter: Fabian Schindler | Owner: nobody
Type: Bug | Status: closed
Component: GIS | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: spatialite geometry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"da0fb5b1ec89a747459ab64482f3202cb452c068" da0fb5b1]:
{{{
#!CommitTicketReference repository=""
revision="da0fb5b1ec89a747459ab64482f3202cb452c068"
Fixed #28380 -- Excluded null geometries in SpatiaLite geometry lookups.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28380#comment:6>

Reply all
Reply to author
Forward
0 new messages