From cdd01ad738f4651897e9debe656af3dd7ac65897 Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Sun, 25 Nov 2012 22:36:15 +0000 Subject: [PATCH] #1869 take care of ST_AsBinary(unknown/text), ST_AsText(unknown/text) is not unique errors git-svn-id: http://svn.osgeo.org/postgis/trunk@10737 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/legacy_minimal.sql.in.c | 17 +++++++++++++++++ regress/legacy.sql | 3 +++ regress/legacy_expected | 1 + 3 files changed, 21 insertions(+) diff --git a/postgis/legacy_minimal.sql.in.c b/postgis/legacy_minimal.sql.in.c index b19ff65bd..8b68e4b11 100644 --- a/postgis/legacy_minimal.sql.in.c +++ b/postgis/legacy_minimal.sql.in.c @@ -61,3 +61,20 @@ CREATE OR REPLACE FUNCTION SRID(geometry) AS 'MODULE_PATHNAME','LWGEOM_get_srid' LANGUAGE 'c' IMMUTABLE STRICT; +-- Deprecation in 1.5.0 +-- hack to allow unknown to cast to geometry +-- so does not yield function is not unique +CREATE OR REPLACE FUNCTION ST_AsBinary(text) + RETURNS bytea + AS + $$ SELECT ST_AsBinary($1::geometry);$$ + LANGUAGE 'sql' IMMUTABLE STRICT; + +-- Deprecation in 1.5.0 +-- hack to allow unknown to cast to geometry +-- so does not yield function is not unique +CREATE OR REPLACE FUNCTION ST_AsText(bytea) + RETURNS text + AS + $$ SELECT ST_AsText($1::geometry);$$ + LANGUAGE 'sql' IMMUTABLE STRICT; diff --git a/regress/legacy.sql b/regress/legacy.sql index 89defe85c..88899da04 100644 --- a/regress/legacy.sql +++ b/regress/legacy.sql @@ -49,6 +49,9 @@ DROP TABLE wmstest; DELETE FROM geometry_columns WHERE f_table_name = 'wmstest' AND f_table_schema = 'public'; SELECT 'Done.'; +-- test #1869 ST_AsBinary is not unique -- +SELECT 1869 As ticket_id, ST_AsText(ST_AsBinary('POINT(1 2)')); + DELETE FROM spatial_ref_sys WHERE SRID = '4326'; \i 00-regress-install/share/contrib/postgis/uninstall_legacy.sql diff --git a/regress/legacy_expected b/regress/legacy_expected index aac80c8b5..d6f34e48f 100644 --- a/regress/legacy_expected +++ b/regress/legacy_expected @@ -17,5 +17,6 @@ MapServer4|-9465|010700000001000|-9465 MapServer4|-9460|010700000001000|-9460 Removing the data table... Done. +1869|POINT(1 2) BEGIN COMMIT -- 2.50.1