[postgis-devel] [PostGIS] #666: ST_DumpPoints is not null safe
PostGIS
trac at osgeo.org
Thu Nov 25 01:05:52 PST 2010
#666: ST_DumpPoints is not null safe
---------------------+------------------------------------------------------
Reporter: robe | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 1.5.3
Component: postgis | Version: 1.5.X
Keywords: |
---------------------+------------------------------------------------------
Comment(by yabo):
Here's a patch. I'm not sure of what should be in the regress test though.
Empty lines ? NULL ? I can't run make check from where I am now.
{{{
Index: postgis/postgis.sql.in.c
===================================================================
--- postgis/postgis.sql.in.c (revision 6203)
+++ postgis/postgis.sql.in.c (working copy)
@@ -1950,6 +1950,10 @@
-- Special case collections : iterate and return the DumpPoints of the
geometries
+ IF (the_geom IS NULL OR ST_IsEmpty(the_geom)) THEN
+ RETURN;
+ END IF;
+
IF (ST_IsCollection(the_geom)) THEN
i = 1;
Index: regress/dumppoints.sql
===================================================================
--- regress/dumppoints.sql (revision 6203)
+++ regress/dumppoints.sql (working copy)
@@ -157,3 +157,19 @@
)'::geometry AS geom
) AS g
) j;
+
+SELECT path, ST_AsText(geom)
+FROM (
+ SELECT (ST_DumpPoints(g.geom)).*
+ FROM
+ (SELECT NULL::geometry AS geom
+ ) AS g
+ ) j;
+
+SELECT path, ST_AsText(geom)
+FROM (
+ SELECT (ST_DumpPoints(g.geom)).*
+ FROM
+ (SELECT 'GEOMETRYCOLLECTION EMPTY'::geometry AS geom
+ ) AS g
+ ) j;
Index: regress/dumppoints_expected
===================================================================
--- regress/dumppoints_expected (revision 6203)
+++ regress/dumppoints_expected (working copy)
@@ -82,3 +82,5 @@
{5,1,2,2}|POINT(5 6)
{5,1,2,3}|POINT(6 6)
{5,1,2,4}|POINT(5 5)
+
+
}}}
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/666#comment:1>
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-devel
mailing list