From: Regina Obe Date: Mon, 20 May 2013 10:41:57 +0000 (+0000) Subject: #2185: failure on 64-bit windows edb. In event of parse error return PG_RETURN_NULL... X-Git-Tag: 2.1.0beta3~49 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b8fa204201a05ca825ee6da0f67d85b8ec30be8;p=postgis #2185: failure on 64-bit windows edb. In event of parse error return PG_RETURN_NULL() instead of forcing functions not to cache (revert last sugar coat change) git-svn-id: http://svn.osgeo.org/postgis/trunk@11482 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/geography.sql.in b/postgis/geography.sql.in index a02dbbeb6..b184552c1 100644 --- a/postgis/geography.sql.in +++ b/postgis/geography.sql.in @@ -105,12 +105,10 @@ CREATE OR REPLACE FUNCTION ST_AsText(geography) LANGUAGE 'c' IMMUTABLE STRICT; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography --- Note: removing immutable because it crashes Windows EDB 9.2x64 bit --- because of some sort of shared memory corruption it triggers on error CREATE OR REPLACE FUNCTION ST_AsText(text) RETURNS text AS $$ SELECT ST_AsText($1::geometry); $$ - LANGUAGE 'sql' STRICT COST 1; + LANGUAGE 'sql' IMMUTABLE STRICT; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_GeographyFromText(text) @@ -422,12 +420,10 @@ CREATE OR REPLACE FUNCTION ST_AsKML(geog geography, maxdecimaldigits int4 DEFAUL -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography -- Deprecated 2.0.0 --- Note: removing immutable because it crashes Windows EDB 9.2x64 bit --- because of some sort of shared memory corruption it triggers on error CREATE OR REPLACE FUNCTION ST_AsKML(text) RETURNS text AS $$ SELECT _ST_AsKML(2, $1::geometry, 15, null); $$ - LANGUAGE 'sql' STRICT COST 1; + LANGUAGE 'sql' IMMUTABLE STRICT; -- ST_AsKML(version, geography, precision, prefix) -- Availability: 2.0.0 nprefix added @@ -448,12 +444,10 @@ CREATE OR REPLACE FUNCTION _ST_AsGeoJson(int4, geography, int4, int4) -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography -- Deprecated in 2.0.0 --- Note: removing immutable because it crashes Windows EDB 9.2x64 bit --- because of some sort of shared memory corruption it triggers on error CREATE OR REPLACE FUNCTION ST_AsGeoJson(text) RETURNS text AS $$ SELECT _ST_AsGeoJson(1, $1::geometry,15,0); $$ - LANGUAGE 'sql' STRICT COST 1; + LANGUAGE 'sql' IMMUTABLE STRICT; -- ST_AsGeoJson(geography, precision, options) / version=1 -- Changed: 2.0.0 to use default args and named args @@ -507,7 +501,7 @@ CREATE OR REPLACE FUNCTION ST_Distance(geography, geography) CREATE OR REPLACE FUNCTION ST_Distance(text, text) RETURNS float8 AS $$ SELECT ST_Distance($1::geometry, $2::geometry); $$ - LANGUAGE 'sql' IMMUTABLE STRICT COST 1; + LANGUAGE 'sql' IMMUTABLE STRICT; -- Only expands the bounding box, the actual geometry will remain unchanged, use with care. -- Availability: 1.5.0 @@ -530,12 +524,10 @@ CREATE OR REPLACE FUNCTION ST_DWithin(geography, geography, float8) LANGUAGE 'sql' IMMUTABLE; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography --- Note: removing immutable because it crashes Windows EDB 9.2x64 bit --- because of some sort of shared memory corruption it triggers on error CREATE OR REPLACE FUNCTION ST_DWithin(text, text, float8) RETURNS boolean AS $$ SELECT ST_DWithin($1::geometry, $2::geometry, $3); $$ - LANGUAGE 'sql' COST 1; + LANGUAGE 'sql' IMMUTABLE; -- ---------- ---------- ---------- ---------- ---------- ---------- ---------- @@ -600,12 +592,10 @@ CREATE OR REPLACE FUNCTION ST_Area(geog geography, use_spheroid boolean DEFAULT COST 100; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography --- Note: removing immutable because it crashes Windows EDB 9.2x64 bit --- because of some sort of shared memory corruption it triggers on error CREATE OR REPLACE FUNCTION ST_Area(text) RETURNS float8 AS $$ SELECT ST_Area($1::geometry); $$ - LANGUAGE 'sql' STRICT COST 1; + LANGUAGE 'sql' IMMUTABLE STRICT; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_Length(geog geography, use_spheroid boolean DEFAULT true) @@ -615,12 +605,10 @@ CREATE OR REPLACE FUNCTION ST_Length(geog geography, use_spheroid boolean DEFAUL COST 100; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography --- Note: removing immutable because it crashes Windows EDB 9.2x64 bit --- because of some sort of shared memory corruption it triggers on error CREATE OR REPLACE FUNCTION ST_Length(text) RETURNS float8 AS $$ SELECT ST_Length($1::geometry); $$ - LANGUAGE 'sql' STRICT COST 1; + LANGUAGE 'sql' IMMUTABLE STRICT; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_Project(geog geography, distance float8, azimuth float8) @@ -668,7 +656,7 @@ CREATE OR REPLACE FUNCTION ST_Covers(geography, geography) CREATE OR REPLACE FUNCTION ST_Covers(text, text) RETURNS boolean AS $$ SELECT ST_Covers($1::geometry, $2::geometry); $$ - LANGUAGE 'sql'; + LANGUAGE 'sql' IMMUTABLE ; -- Only implemented for polygon-over-point -- Availability: 1.5.0 @@ -681,7 +669,7 @@ CREATE OR REPLACE FUNCTION ST_CoveredBy(geography, geography) CREATE OR REPLACE FUNCTION ST_CoveredBy(text, text) RETURNS boolean AS $$ SELECT ST_CoveredBy($1::geometry, $2::geometry); $$ - LANGUAGE 'sql' ; + LANGUAGE 'sql' IMMUTABLE ; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_Segmentize(geog geography, max_segment_length float8) @@ -700,7 +688,7 @@ CREATE OR REPLACE FUNCTION ST_Intersects(geography, geography) CREATE OR REPLACE FUNCTION ST_Intersects(text, text) RETURNS boolean AS $$ SELECT ST_Intersects($1::geometry, $2::geometry); $$ - LANGUAGE 'sql' ; + LANGUAGE 'sql' IMMUTABLE ; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION _ST_BestSRID(geography, geography) @@ -736,7 +724,7 @@ CREATE OR REPLACE FUNCTION ST_Intersection(geography, geography) CREATE OR REPLACE FUNCTION ST_Intersection(text, text) RETURNS geometry AS $$ SELECT ST_Intersection($1::geometry, $2::geometry); $$ - LANGUAGE 'sql' IMMUTABLE STRICT COST 1; + LANGUAGE 'sql' IMMUTABLE STRICT; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_AsBinary(geography) @@ -760,7 +748,7 @@ CREATE OR REPLACE FUNCTION ST_AsEWKT(geography) CREATE OR REPLACE FUNCTION ST_AsEWKT(text) RETURNS text AS $$ SELECT ST_AsEWKT($1::geometry); $$ - LANGUAGE 'sql' IMMUTABLE STRICT COST 1; + LANGUAGE 'sql' IMMUTABLE STRICT; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION GeometryType(geography) diff --git a/postgis/lwgeom_inout.c b/postgis/lwgeom_inout.c index 8c043ec73..e0652fb07 100644 --- a/postgis/lwgeom_inout.c +++ b/postgis/lwgeom_inout.c @@ -62,8 +62,10 @@ Datum LWGEOM_in(PG_FUNCTION_ARGS) lwgeom_parser_result_init(&lwg_parser_result); /* Empty string. */ - if ( str[0] == '\0' ) + if ( str[0] == '\0' ) { ereport(ERROR,(errmsg("parse error - invalid geometry"))); + PG_RETURN_NULL(); + } /* Starts with "SRID=" */ if( strncasecmp(str,"SRID=",5) == 0 ) @@ -108,6 +110,7 @@ Datum LWGEOM_in(PG_FUNCTION_ARGS) if ( lwgeom_parse_wkt(&lwg_parser_result, str, LW_PARSER_CHECK_ALL) == LW_FAILURE ) { PG_PARSER_ERROR(lwg_parser_result); + PG_RETURN_NULL(); } lwgeom = lwg_parser_result.geom; if ( lwgeom_needs_bbox(lwgeom) )