[postgis-devel] Empty for Discussion

Regina Obe lr at pcorp.us
Fri Feb 10 15:48:58 PST 2023


I get 0 for num geometries, and NULL for ST_GeometryN(..,1)

 

POSTGIS="3.4.0dev 3.3.0rc2-590-gdd3d8a4cd" [EXTENSION] PGSQL="160" GEOS="3.12.0dev-CAPI-1.18.0" PROJ="7.2.1" LIBXML="2.9.14" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)"

 

In theory you are right :) But the answers at least agree and that’s all I care about.

 

Agree in the sense, that yes if number of geometries is 0, then I expect ST_GeometryN of anything to give me NULL back.  It has also been like that for quite some time so all supported versions I assume agree (I didn’t check 3.0).

 

Not worth breaking to me for a geometry I hope people aren’t even using and if they are using these, they are probably relying on this bug as a feature.

 

Regina

 

 

From: postgis-devel [mailto:postgis-devel-bounces at lists.osgeo.org] On Behalf Of Martin Davis
Sent: Friday, February 10, 2023 3:17 PM
To: PostGIS Development Discussion <postgis-devel at lists.osgeo.org>
Subject: Re: [postgis-devel] Empty for Discussion

 

Note my result for ST_GeometryN is on PostGIS 3.1.4.  More recent versions might be different (i.e. returning NULL)?

 

On Fri, Feb 10, 2023 at 12:02 PM Martin Davis <mtnclimb at gmail.com <mailto:mtnclimb at gmail.com> > wrote:

So seems to me that 

 

ST_NumGeometries('GEOMETRYCOLLECTION(POINT EMPTY, POINT EMPTY)'::geometry) 

==> 0

 

is inconsistent with 

 

ST_GeometryN('GEOMETRYCOLLECTION(POINT EMPTY, POINT EMPTY)'::geometry, 1)

==> POINT EMPTY

 

I think ST_NumGeometries('GEOMETRYCOLLECTION(POINT EMPTY, POINT EMPTY)'::geometry) should return 2.

 

On Fri, Feb 10, 2023 at 11:39 AM Paul Ramsey <pramsey at cleverelephant.ca <mailto:pramsey at cleverelephant.ca> > wrote:

select st_astext('GEOMETRYCOLLECTION(POINT EMPTY, POINT EMPTY)'::geometry);
select st_isempty('GEOMETRYCOLLECTION(POINT EMPTY, POINT EMPTY)'::geometry);
select st_numgeometries('GEOMETRYCOLLECTION(POINT EMPTY, POINT EMPTY)'::geometry); st_numgeometries 
select st_astext(st_geometryn('GEOMETRYCOLLECTION(POINT EMPTY, POINT EMPTY)'::geometry, 1));

_______________________________________________
postgis-devel mailing list
postgis-devel at lists.osgeo.org <mailto:postgis-devel at lists.osgeo.org> 
https://lists.osgeo.org/mailman/listinfo/postgis-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20230210/bfc5aeda/attachment.htm>


More information about the postgis-devel mailing list