[postgis-tickets] [PostGIS] #2242: ST_Union in aggregate form treats NULL as EMPTY

PostGIS trac at osgeo.org
Thu Mar 21 04:21:29 PDT 2013


#2242: ST_Union in aggregate form treats NULL as EMPTY
------------------------+---------------------------------------------------
 Reporter:  gabrimonfa  |       Owner:  pramsey
     Type:  defect      |      Status:  new    
 Priority:  medium      |   Milestone:         
Component:  postgis     |     Version:  2.0.x  
 Keywords:              |  
------------------------+---------------------------------------------------
 ST_Union of two geometries, one of which is null, returns null, using the
 same semantic for null used in SQL.

 However, the aggregate form of ST_Union returns the other geometry,
 treating null geometry as an EMPTY geometry.

 {{{
 \pset null '<<NULL>>'

 SELECT ST_AsText(ST_Union(NULL::geometry,'POLYGON((0 0,0 1,1 1,1 0,0
 0))'::geometry));
  st_astext
 -----------
  <<NULL>>
 (1 riga)

 SELECT ST_AsText(ST_Union(g)) FROM (SELECT NULL::geometry as g UNION
 SELECT 'POLYGON((0 0,0 1,1 1,1 0,0 0))'::geometry as g) foo;
            st_astext
 --------------------------------
  POLYGON((0 0,0 1,1 1,1 0,0 0))
 }}}


 Expected result was that it returns null, also because EMPTY geometries do
 exists.
 See [http://trac.osgeo.org/postgis/wiki/DevWikiEmptyGeometry]

 If this behavior is intended, we should probably state it clearly in the
 documentation

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2242>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list