[postgis-users] GeometryCollection(Empty) is SRID dependent (orsupporting nulls in st_union)

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Sun Sep 28 00:37:09 PDT 2008


Paragon Corporation wrote:

> All RDBMS I know when you sum up things with nulls you get the result
> without the null (there are rare aggregates where it is not advantageous to
> do that).  Whether that is right or wrong is another question, but it seems
> pretty baked into the standard
> of how RDBMS work and its convenient because in general that's the behavior
> you want and its easy to generate the reverse behavior of what you describe
> by slapping a coalesce/case when everywhere, but its not quite so easy to go
> the other way around.  Think about it how would you say count only things
> that aren't null.

It seems wise not to buck the trend in this instance; it seems that the 
commonly expected behaviour is for aggregates to ignore null inputs, but 
return null only if the input set is empty.

Charlie, if you want to experiment with this AFAICT the fix is simple: 
remove the STRICT declaration from ST_unite_garray in lwpostgis.sql. 
This should then allow the aggregate to continue if a null is encountered.

Oh and again, please file on the PostGIS bug tracker lest we forget :)

>> Is an empty geometry value different from a null in a geometry column?  
>> Can an empty geometry have a SRID (& a null can't)?
>> In what cases would it make sense to replace null geometries with empty
> ones?
> 
> No.  They are not functionally the same.  For example the intersection of 2
> disjoint geometries is obviously an empty collection - it is known therefore
> it is not null
> And  that empty collection should have the same srid of the 2 geometries
> being intersected.

I think the question being asked here is: does an empty 
geometrycollection have a SRID? My instinct says no, but then I don't 
deal with them enough everyday to get a feeling for what the expected 
behaviour should be.


ATB,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-users mailing list