[postgis-tickets] [PostGIS] #4736: ST_NumGeometries is zero for GeometryCollection with empty parts

PostGIS trac at osgeo.org
Thu Jul 29 14:38:14 PDT 2021


#4736: ST_NumGeometries is zero for GeometryCollection with empty parts
-------------------------+---------------------------
  Reporter:  Mike Taves  |      Owner:  strk
      Type:  defect      |     Status:  assigned
  Priority:  medium      |  Milestone:  PostGIS 3.0.4
 Component:  postgis     |    Version:  2.4.x
Resolution:              |   Keywords:
-------------------------+---------------------------

Comment (by pramsey):

 Although, equally, it's possible that zero elements and null-on-access is
 better...
 {{{
 ST_NumGeometries('POINT EMPTY') => 0
 ST_NumGeometries('GEOMETRYCOLLECTION EMPTY') => 0
 ST_NumGeometries('GEOMETRYCOLLECTION(POINT EMPTY)') => 0
 ST_GeometryN('POINT EMPTY', 1) => NULL
 ST_GeometryN('GEOMETRYCOLLECTION EMPTY', 1) => NULL
 ST_GeometryN('GEOMETRYCOLLECTION(POINT EMPTY)', 1) => NULL
 }}}
 Matches out-of-range behaviour and zero-count behaviour in existing code.
 Makes it impossible to access sub-geometries of empty. I think I like this
 one more.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4736#comment:9>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list