]> granicus.if.org Git - postgis/commitdiff
#2279: fix inability to upgrade from 2.0 to 2.1 by renaming old geog/geom selectivity...
authorRegina Obe <lr@pcorp.us>
Sun, 28 Apr 2013 21:27:40 +0000 (21:27 +0000)
committerRegina Obe <lr@pcorp.us>
Sun, 28 Apr 2013 21:27:40 +0000 (21:27 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11327 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/postgis_drop_before.sql

index 88773552981f5325e6b46b2bd206226471e1b741..48138c7ac08307a6d87ad4fa6f9f582387e88fbb 100644 (file)
@@ -3,10 +3,10 @@
 -- $Id$
 --
 -- PostGIS - Spatial Types for PostgreSQL
--- http://postgis.refractions.net
+-- http://postgis.net
 --
 -- Copyright (C) 2011-2012 Sandro Santilli <strk@keybit.net>
--- Copyright (C) 2010-2012 Regina Obe <lr@pcorp.us>
+-- Copyright (C) 2010-2013 Regina Obe <lr@pcorp.us>
 -- Copyright (C) 2009      Paul Ramsey <pramsey@cleverelephant.ca>
 --
 -- 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;
+$$ ;