]> granicus.if.org Git - postgis/commitdiff
revise extension upgrade builder to use new remove functions from extension before...
authorRegina Obe <lr@pcorp.us>
Mon, 14 Nov 2011 08:15:13 +0000 (08:15 +0000)
committerRegina Obe <lr@pcorp.us>
Mon, 14 Nov 2011 08:15:13 +0000 (08:15 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8152 b70326c6-7e19-0410-871a-916f4a2858ee

extensions/postgis/Makefile
extensions/postgis/postgis.control
extensions/postgis/sql_bits/remove_from_extension.sql.in [new file with mode: 0644]

index 4bb077da8bc0ce48d0a0ff3da98acb929ec675dc..4b5dcf330d3a17a97125a7d1cc50a105d3f4cc34 100644 (file)
@@ -15,7 +15,7 @@ EXTRA_CLEAN += sql/$(EXTENSION).sql ${SQL_BITS}
 ifeq ($(PG91),yes)
 sql/$(EXTENSION).sql: sql_bits/postgis.sql sql_bits/postgis_comments.sql sql_bits/rtpostgis.sql sql_bits/raster_comments.sql sql_bits/spatial_ref_sys.sql
        cat $^ > $@
-all: sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--2.0.0a3--$(EXTVERSION).sql #sql/$(EXTENSION)--2.0.0a2--$(EXTVERSION).sql
+all: sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--2.0.0a3--$(EXTVERSION).sql sql/$(EXTENSION)--2.0.0a4--$(EXTVERSION).sql sql/$(EXTENSION)--2.0.0a5--$(EXTVERSION).sql
 
 sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
        cp $< $@
@@ -37,29 +37,29 @@ sql_bits/postgis_comments.sql: ../../doc/postgis_comments.sql
 sql_bits/rtpostgis.sql: ../../raster/rt_pg/rtpostgis.sql
        sed -e 's/BEGIN;//g' -e 's/COMMIT;//g'  $< > $@
        
-sql_bits/raster_comments.sql: ../../doc/raster_comments.sql
-       cp $< $@
-       
-sql_bits/postgis_upgrade_minor.sql:  sql_bits/postgis.sql
-        sed -e '/^\(CREATE\|ALTER\|DROP\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\|OPERATOR\|AGGREGATE\|FUNCTION\).*;/d' \
-                -e '/^\(CREATE\|ALTER\|DROP\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\|OPERATOR\|AGGREGATE\|FUNCTION\)/,/\;/d' \
-                $< > $@
-                
-sql_bits/postgis_drop_before.sql:  ../../postgis/postgis_drop_before.sql.in.c
-        sed -e 's/^DROP \(FUNCTION\) [\(IF EXISTS\)]*\(.*\);/ALTER EXTENSION $(EXTENSION) DROP \1 \2;DROP \1 IF EXISTS \2 ;/' \
+#can't use the one built because can't drop the postgis_version function
+#leave out all casts, operators, types, tables, schema, and aggregates
+sql_bits/postgis_upgrade_minor.sql: ../../postgis/postgis.sql 
+                sed -e '/^\(CREATE\|ALTER\) \(CAST\|OPERATOR\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\|AGGREGATE\).*;/d' \
+                       -e '/^\(CREATE\|ALTER\) \(CAST\|OPERATOR\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\|AGGREGATE\)/,/\;/d' \
+                       -e 's/BEGIN;//g' -e 's/COMMIT;//g' \
                 $< > $@
+
        
-sql_bits/postgis_raster_upgrade_minor.sql:  sql_bits/postgis_drop_before.sql sql_bits/postgis_upgrade_minor.sql ../../raster/rt_pg/rtpostgis_upgrade_20_minor.sql
+sql_bits/raster_comments.sql: ../../doc/raster_comments.sql
+       cp $< $@
+
+sql_bits/postgis_raster_upgrade_minor.sql: ../postgis_extension_helper.sql sql_bits/remove_from_extension.sql.in ../../postgis/postgis_drop_before.sql.in.c  sql_bits/postgis_upgrade_minor.sql        ../../raster/rt_pg/rtpostgis_upgrade_20_minor.sql  ../../doc/raster_comments.sql  ../../doc/postgis_comments.sql ../postgis_extension_helper_uninstall.sql
        cat $^ > $@
 
-# remove begin commits
-# exclude type, cast, table creations
-# we need to drop aggregates, casts, functions from the extension before we can drop them
 sql/$(EXTENSION)--2.0.0a3--$(EXTVERSION).sql: sql_bits/postgis_raster_upgrade_minor.sql
-       sed  -e 's/BEGIN;//g' -e 's/COMMIT;//g' -e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\).*;/d' \
-                -e '/^\(CREATE\|ALTER\|DROP\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\)/,/\;/d' \
-                -e 's/^DROP \(AGGREGATE\|OPERATOR\|FUNCTION\) [\(IF EXISTS\)]*\(.*\);/ALTER EXTENSION $(EXTENSION) DROP \1 \2;DROP \1 IF EXISTS \2 ;/' \
-                $< > $@
+       cp $< $@
+       
+sql/$(EXTENSION)--2.0.0a4--$(EXTVERSION).sql: sql_bits/postgis_raster_upgrade_minor.sql
+       cp $< $@
+       
+sql/$(EXTENSION)--2.0.0a5--$(EXTVERSION).sql: sql_bits/postgis_raster_upgrade_minor.sql
+       cp $< $@
        
 # sql_bits/rtpostgis--unpackaged.sql:  ../../raster/rt_pg/rtpostgis.sql         
 #      sed -e 's/^[\t]*//' \
index d5b3cc8bcd24bd643fa006a7981ec1908a13195f..351187f8673a2f5a8362c2a9f4dc30b97104b827 100644 (file)
@@ -1,5 +1,5 @@
 # postgis extension
 comment = 'postgis geometry,geography, and raster spatial types and functions'
-default_version = '2.0.0a5'
+default_version = '2.0.0a6'
 module_pathname = '$libdir/postgis-2.0'
 relocatable = true
diff --git a/extensions/postgis/sql_bits/remove_from_extension.sql.in b/extensions/postgis/sql_bits/remove_from_extension.sql.in
new file mode 100644 (file)
index 0000000..cd710eb
--- /dev/null
@@ -0,0 +1,20 @@
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+-- 
+-- $Id: postgis_extension_helper_uninstall.sql 7936 2011-11-12 14:33:23Z robe $
+----
+-- PostGIS - Spatial Types for PostgreSQL
+-- http://www.postgis.org
+--
+-- Copyright (C) 2011 Regina Obe <lr@pcorp.us>
+--
+-- This is free software; you can redistribute and/or modify it under
+-- the terms of the GNU General Public Licence. See the COPYING file.
+--
+-- Author: Regina Obe <lr@pcorp.us>
+--  
+-- This drops extension helper functions
+-- and should be called at the end of the extension upgrade file
+-- removes all postgis_topology functions from postgis_topology extension since they will be readded 
+-- during upgrade
+SELECT postgis_extension_remove_objects('postgis', 'FUNCTION');
+--SELECT postgis_extension_remove_objects('postgis', 'AGGREGATE');