[postgis-devel] ST_Union, ST_Collect and ST_Difference strictness

Darafei "Komяpa" Praliaskouski me at komzpa.net
Mon Dec 18 06:03:09 PST 2017


Hi all,

I propose to change strictness for ST_Union, ST_Collect and ST_Difference
to non-strict.

It's common in my workflows to have constructs like

ST_Difference(a.geom, (select ST_Union(geom) from clipping_table b where
ST_Intersects(a.geom, b.geom)))

Right now it has not evident side effect of geometries disappearing if
ST_Union had no rows to collect. It surely can be fixed with coalesce, but
you have to first know of such behavior with NULLs. :)

So, I propose non-strict handling of nulls:
ST_Union(A, NULL) => A,
ST_Union(NULL, A) => A,
ST_Union(NULL, NULL) => NULL,
ST_Collect(A, NULL) => A,
ST_Collect(NULL, A) => A,
ST_Collect(NULL, NULL) => NULL,
ST_Difference(A, NULL) = A,
ST_Difference(NULL, *) = NULL.

any thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20171218/dd786f79/attachment.html>


More information about the postgis-devel mailing list