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

Brent Wood pcreso at pcreso.com
Sat Sep 27 13:15:06 PDT 2008


That gets back to how nulls should be handled generally. 

If you take the sum() (or avg(), max(), etc) of a numeric column with nulls, what should the result be?

IMO it should be a null, as we really don't know. If the nulls in the set comprise unknown values, then any result predicated on them is also unknown. 

If the user wants the sum(), etc, of the not null values then they can ask for that easily enough via a where clause.

However RDBMS's don't typically do this. Changing the function to mimic others makes them more consistent, but not necessarily better. 

But it does make sense to not generate SRID based errors where the failing geometries are not actually used in the result set though.


I'm also unclear on the way Postgis treats empty geometries vs null geometries, or if they are functionally the same thing. 

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?


Cheers,

  Brent Wood



--- On Sun, 9/28/08, Charlie Savage <cfis at savagexi.com> wrote:

> From: Charlie Savage <cfis at savagexi.com>
> Subject: Re: [postgis-users] GeometryCollection(Empty) is SRID dependent (or supporting nulls in st_union)
> To: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
> Date: Sunday, September 28, 2008, 7:51 AM
> Paragon Corporation wrote:
> > I'm wondering if it might be better to just change
> the st_geom_accum
> > function  that all the aggregate functions rely on to
> collect the geometries
> > to just ignore nulls.
> > 
> > I can't think of a reason why any of the spatial
> aggregates should even be
> > bothered with nulls.  
> 
> Thanks works for me.
> 
> Charlie
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list