[postgis-devel] [PostGIS] #408: Catch "Exception in LWGEOM2GEOS" in ST_IsValid
Martin Davis
mbdavis at refractions.net
Thu Feb 4 13:26:38 PST 2010
Right, this has just been explained to me by our resident PostGIS expert
Kevin. To repeat his explanation, the PostgreSQL language engine is
auto-converting the string to a Geometry type, since that's what
st_isvalid accepts. This is where the exception is happening - which
means that it can't be caught inside st_isvalid.
I would humbly suggest that it would be nice to be able to prevent C
exceptions leaking out into the SQL world where possible. Perhaps a
st_isvalid_safe(String geomWKT)
could be provided to allow users to avoid this. (And since Kevin also
pointed out that this doesn't allow distinguishing between Geometry and
the new Geography type, a
st_isvalid_geog_safe(String geogWKT)
might be needed as well.
Code it up and let the users vote with their keyboards!
PostGIS wrote:
> #408: Catch "Exception in LWGEOM2GEOS" in ST_IsValid
> --------------------------+-------------------------------------------------
> Reporter: ddegasperi | Owner: pramsey
> Type: enhancement | Status: new
> Priority: medium | Milestone:
> Component: postgis | Version: 1.4.X
> Resolution: | Keywords:
> --------------------------+-------------------------------------------------
> Comment (by pramsey):
>
> Non possible.
>
> The '':text entry first gets passed into the text parsing routines which
> is where the failure actually occurs, not in st_isvalid. We have had
> internal arguments many times about where validity checking should occur,
> and the current situation is that trivially invalid geometries (1-point
> lines, unclosed polygons) are failed during parsing.
>
> IMO, they shouldn't fail, but that's a personal opinion, not a consensus
> one.
>
>
--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022
More information about the postgis-devel
mailing list