Opened 14 years ago
Closed 13 years ago
#835 closed defect (fixed)
ST_CollectionExtract returns EMPTY or NULL inconsistently
Reported by: | strk | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.0.0 |
Component: | postgis | Version: | master |
Keywords: | history | Cc: |
Description
Request a POINT from a LINE and you get a NULL. Request a POINT from an EMPTY and you get an EMPTY.
Consistently returning NULL sounds like a good idea. Do you agree ?
See http://postgis.refractions.net/pipermail/postgis-devel/2011-February/011830.html
Change History (8)
comment:1 by , 14 years ago
comment:3 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Ok, I've fixed liblwgeom to return typed EMPTIES in absence of matching types (r8717) But liblwgeom only wants COLLECTION input so can't do everything on itself.
The wrapper I then fixed to always return NULL on type miss, no matter input (be it a complex multilevel collection or a simple empty, of any type). This is r8718.
Note that I had to change an expected return in regress/regress.sql (test 159) -- other existing tests were in tickets.sql and expected NULL for other kind of inputs.
At least we're consistent now: NULL return when no matches are found. It's easy for me to get back on typed empty instead, if you scream loud enough.
comment:4 by , 13 years ago
Mind you: documentation needs to be updated about it. The current one says only COLLECTION input is supported and mentions EMPTY COLLECTION is returned on missing types.
comment:5 by , 13 years ago
I'd be in favor of a ST_TypeExtract also using 0,1,2 for type (ala dimension)
comment:6 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
reopening due to requirement of documentation update
comment:7 by , 13 years ago
comment:8 by , 13 years ago
Keywords: | history added |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Documentation updated with r8722.
Intuitively that sounds like a better behaviour but I'd wait for more votes on this. Note that we had this whole discussion several months ago, and hence documented the behaviour on the developer wiki here: http://trac.osgeo.org/postgis/wiki/DevWikiEmptyGeometry. I'd go through the similar cases there to get a feel for what the correct behaviour should be.