[postgis-devel] Empty for Discussion

Regina Obe lr at pcorp.us
Fri Feb 10 16:39:01 PST 2023


> > 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).
> >
> 
> Right, but we're talking about GEOMETRYCOLLECTION(POINT EMPTY, POINT
> EMPTY) here, which has... 2 geometries in the collection.

Yes the answer 2 is more right than 0 I suppose, but I don't think 0 is necessarily wrong either.

If I collect all the candy bags from some kids and combine them and dump out all of the candy?  How much candy do I dump out if no one went trick-o-treating = 0.

As an accountant once send to me, as long as the answers all agree, that's the most important thing.
ST_Dump, ST_DumpPoints, ST_GeometryN, ST_NumGeometries all agree, if you ask for nothing, you don't get something back.

Should we change it, I say not worth the trouble unless there is a major issue you are seeing that is resulting.

I'm more concerned about people relying on:
 
ST_NumGeometries(GEOMETRYCOLLECTION EMPTY ) = ST_NumGeometries(GEOMETRYCOLLECTION(POINT EMPTY, POINT EMPTY)
Having the same number of elements 

And that 

ST_DumpPoints and ST_Dump of empty geometries result in nothing being dumped.

Fixing this will break their workflow.

Thanks,
Regina




More information about the postgis-devel mailing list