[postgis-tickets] [PostGIS] #5478: ST_GeometryN should thrown an error when requesting the 0th geometry

PostGIS trac at osgeo.org
Thu Aug 17 13:11:20 PDT 2023


#5478: ST_GeometryN should thrown an error when requesting the 0th geometry
-------------------------+---------------------------
 Reporter:  jgh          |      Owner:  pramsey
     Type:  enhancement  |     Status:  new
 Priority:  low          |  Milestone:  PostGIS 3.3.5
Component:  postgis      |    Version:  3.3.x
 Keywords:               |
-------------------------+---------------------------
 ST_GeometryN(geom,index) is using a 1-based index and was, in the past,
 using a 0-based index.

 Calling it with index 0 returns null.

 I suggest to throw an error (index is out of bound, or index should be >
 0) in such situation, as it can never succeed.

 For a bit of context, it was noticed during a column type change (multi to
 single) as all geometries vanished.


 {{{
 alter table test
   alter column geom type geometry(linestring,4326)
     using st_geometryN(geom,0);
 }}}
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5478>
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