Ticket #835 (closed defect: fixed)

Opened 15 months ago

Last modified 5 months ago

ST_CollectionExtract returns EMPTY or NULL inconsistently

Reported by: strk Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: trunk
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

Changed 15 months ago by mcayland

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.

Changed 5 months ago by strk

See #457, where NULL was decided as a return for "type-misses"

Changed 5 months ago by strk

  • status changed from new to closed
  • resolution set to fixed

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.

Changed 5 months ago by strk

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.

Changed 5 months ago by strk

I'd be in favor of a ST_TypeExtract also using 0,1,2 for type (ala dimension)

Changed 5 months ago by strk

  • status changed from closed to reopened
  • resolution fixed deleted

reopening due to requirement of documentation update

Changed 5 months ago by strk

r8720 changes back on always returning EMPTY. Seems closer to both documentation and what was requested in #457. Documentation still needs some tweaking.

Changed 5 months ago by strk

  • keywords history added
  • status changed from reopened to closed
  • resolution set to fixed

Documentation updated with r8722.

Note: See TracTickets for help on using tickets.