From c06a4be5c8870d0f36a15c9b30d59a62fc742d4b Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Sun, 28 Apr 2013 21:27:40 +0000 Subject: [PATCH] #2279: fix inability to upgrade from 2.0 to 2.1 by renaming old geog/geom selectivity functions to new name (if they are currently used) aand then allowing the standard upgrade to steam roll over the definitions. git-svn-id: http://svn.osgeo.org/postgis/trunk@11327 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/postgis_drop_before.sql | 37 +++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/postgis/postgis_drop_before.sql b/postgis/postgis_drop_before.sql index 887735529..48138c7ac 100644 --- a/postgis/postgis_drop_before.sql +++ b/postgis/postgis_drop_before.sql @@ -3,10 +3,10 @@ -- $Id$ -- -- PostGIS - Spatial Types for PostgreSQL --- http://postgis.refractions.net +-- http://postgis.net -- -- Copyright (C) 2011-2012 Sandro Santilli --- Copyright (C) 2010-2012 Regina Obe +-- Copyright (C) 2010-2013 Regina Obe -- Copyright (C) 2009 Paul Ramsey -- -- This is free software; you can redistribute and/or modify it under @@ -26,3 +26,36 @@ DROP FUNCTION IF EXISTS ST_MakeEnvelope(float8, float8, float8, float8); DROP FUNCTION IF EXISTS ST_AsX3D(geometry, integer, integer); --changed name of arg: http://trac.osgeo.org/postgis/ticket/1606 DROP FUNCTION IF EXISTS UpdateGeometrySRID(varchar,varchar,varchar,varchar,integer); + +--deprecated and removed in 2.1 +-- Hack to fix 2.0 naming +-- We can't just drop it since its bound to opclass +-- See ticket 2279 for why we need to do this +-- We can get rid of this DO code when 3.0 comes along +DO language 'plpgsql' $$ +BEGIN + -- fix geometry ops -- + IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprrest::text = 'geometry_gist_sel_2d') THEN + --it is bound to old name, drop new, rename old to new, install will fix body of code + DROP FUNCTION IF EXISTS gserialized_gist_sel_2d(internal, oid, internal, int4) ; + ALTER FUNCTION geometry_gist_sel_2d(internal, oid, internal, int4) RENAME TO gserialized_gist_sel_2d; + END IF; + IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprjoin::text = 'geometry_gist_joinsel_2d') THEN + --it is bound to old name, drop new, rename old to new, install will fix body of code + DROP FUNCTION IF EXISTS gserialized_gist_joinsel_2d(internal, oid, internal, smallint) ; + ALTER FUNCTION geometry_gist_joinsel_2d(internal, oid, internal, smallint) RENAME TO gserialized_gist_joinsel_2d; + END IF; + -- fix geography ops -- + IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprrest::text = 'geography_gist_selectivity') THEN + --it is bound to old name, drop new, rename old to new, install will fix body of code + DROP FUNCTION IF EXISTS gserialized_gist_sel_nd(internal, oid, internal, smallint) ; + ALTER FUNCTION geography_gist_selectivity(internal, oid, internal, int4) RENAME TO gserialized_gist_sel_nd; + END IF; + + IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprjoin::text = 'geography_gist_join_selectivity') THEN + --it is bound to old name, drop new, rename old to new, install will fix body of code + DROP FUNCTION IF EXISTS gserialized_gist_joinsel_nd(internal, oid, internal, int4) ; + ALTER FUNCTION geography_gist_join_selectivity(internal, oid, internal, smallint) RENAME TO gserialized_gist_joinsel_nd; + END IF; +END; +$$ ; -- 2.50.1