[postgis-tickets] r16063 - Upgrade during create extension from unpackaged

Sandro Santilli strk at kbt.io
Wed Oct 25 23:46:51 PDT 2017


Author: strk
Date: 2017-10-25 23:46:50 -0700 (Wed, 25 Oct 2017)
New Revision: 16063

Removed:
   trunk/extensions/postgis/unpackaged_check.sql.in
   trunk/extensions/postgis_topology/unpackaged_check.sql.in
Modified:
   trunk/.gitignore
   trunk/NEWS
   trunk/extensions/postgis/Makefile.in
   trunk/extensions/postgis_topology/Makefile.in
Log:
Upgrade during create extension from unpackaged

This commit does it for "postgis" and "postgis_topology"
extensions.

Closes #3913

Modified: trunk/.gitignore
===================================================================
--- trunk/.gitignore	2017-10-26 01:08:26 UTC (rev 16062)
+++ trunk/.gitignore	2017-10-26 06:46:50 UTC (rev 16063)
@@ -48,7 +48,6 @@
 extensions/address_standardizer/us-*.sql
 extensions/postgis/Makefile
 extensions/postgis/postgis.control
-extensions/postgis/unpackaged_check.sql
 extensions/postgis/sql/
 extensions/postgis/sql_bits/*.sql
 extensions/postgis_sfcgal/Makefile
@@ -65,7 +64,6 @@
 extensions/postgis_tiger_geocoder/sql_bits/tiger_geocoder_minor.sql.in
 extensions/postgis_topology/Makefile
 extensions/postgis_topology/postgis_topology.control
-extensions/postgis_topology/unpackaged_check.sql
 extensions/postgis_topology/sql/
 extensions/postgis_topology/sql_bits/*.sql
 GNUmakefile

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2017-10-26 01:08:26 UTC (rev 16062)
+++ trunk/NEWS	2017-10-26 06:46:50 UTC (rev 16063)
@@ -5,6 +5,7 @@
   - #3876, ST_Angle function (RĂ©mi Cura)
   - #3564, ST_LineInterpolatePoints (Dan Baston)
   - #3896, PostGIS_Extensions_Upgrade()
+  - #3913, Upgrade when creating extension from unpackaged (Sandro Santilli)
 
 * Breaking Changes *
   - #3885, version number removed from address_standardize lib file
@@ -20,8 +21,6 @@
   - TopoGeo_addLinestring robustness improvements (Sandro Santilli)
     #1855, #1946, #3718, #3838
   - #3234, Do not accept EMPTY points as topology nodes (Sandro Santilli)
-  - #3892, Prevent version mixup when creating extension from unpackaged
-           (Sandro Santilli)
   - #1014, Hashable geometry, allowing direct use in CTE signatures (Paul Ramsey)
 
 

Modified: trunk/extensions/postgis/Makefile.in
===================================================================
--- trunk/extensions/postgis/Makefile.in	2017-10-26 01:08:26 UTC (rev 16062)
+++ trunk/extensions/postgis/Makefile.in	2017-10-26 06:46:50 UTC (rev 16063)
@@ -79,9 +79,9 @@
 sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql | sql
 	cp $< $@
 
-sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) ../../utils/create_unpackaged.pl unpackaged_check.sql Makefile | sql
+sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) sql/$(EXTENSION)--ANY--$(EXTVERSION).sql ../../utils/create_unpackaged.pl Makefile | sql
 	# Ensure version is correct
-	cat unpackaged_check.sql > $@
+	cat sql/$(EXTENSION)--ANY--$(EXTVERSION).sql > $@
 	cat $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) \
 		| $(PERL) ../../utils/create_unpackaged.pl postgis \
 		>> $@

Deleted: trunk/extensions/postgis/unpackaged_check.sql.in
===================================================================
--- trunk/extensions/postgis/unpackaged_check.sql.in	2017-10-26 01:08:26 UTC (rev 16062)
+++ trunk/extensions/postgis/unpackaged_check.sql.in	2017-10-26 06:46:50 UTC (rev 16063)
@@ -1,14 +0,0 @@
-DO $$
-DECLARE
-	ver TEXT;
-BEGIN
-	ver := split_part(postgis_scripts_installed(), ' ', 1);
-	IF ver != '@EXTVERSION@' THEN
-		RAISE EXCEPTION 'Installed PostGIS version is %', ver
-		USING HINT = 'Try `CREATE EXTENSION postgis VERSION '''
-			|| ver || ''' from unpackaged`,'
-			' or source postgis_upgrade.sql`';
-	END IF;
-END;
-$$ LANGUAGE 'plpgsql';
-

Modified: trunk/extensions/postgis_topology/Makefile.in
===================================================================
--- trunk/extensions/postgis_topology/Makefile.in	2017-10-26 01:08:26 UTC (rev 16062)
+++ trunk/extensions/postgis_topology/Makefile.in	2017-10-26 06:46:50 UTC (rev 16063)
@@ -60,17 +60,12 @@
 sql_bits/topology_comments.sql: ../../doc/topology_comments.sql
 	cp $< $@
 
-sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: ../../topology/topology.sql ../../utils/create_unpackaged.pl unpackaged_check.sql Makefile
+sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: ../../topology/topology.sql ../../utils/create_unpackaged.pl sql/$(EXTENSION)--ANY--$(EXTVERSION).sql Makefile
 	mkdir -p sql
-	# Ensure version is correct
-	cat unpackaged_check.sql > $@
+	# Ugprade before packaging
+	cat sql/$(EXTENSION)--ANY--$(EXTVERSION).sql > $@
 	cat $< | $(PERL) ../../utils/create_unpackaged.pl postgis_topology >> $@
 
-unpackaged_check.sql: unpackaged_check.sql.in Makefile
-	cat $< \
-		| sed -e 's|@EXTVERSION@|$(EXTVERSION)|g' \
-		> $@
-
 #upgrade script should have everything but table, schema, type creation/alter
 #NOTE: we assume all object definitions end in ;
 #first expression deletes all non-removable objects defined on same line

Deleted: trunk/extensions/postgis_topology/unpackaged_check.sql.in
===================================================================
--- trunk/extensions/postgis_topology/unpackaged_check.sql.in	2017-10-26 01:08:26 UTC (rev 16062)
+++ trunk/extensions/postgis_topology/unpackaged_check.sql.in	2017-10-26 06:46:50 UTC (rev 16063)
@@ -1,14 +0,0 @@
-DO $$
-DECLARE
-	ver TEXT;
-BEGIN
-	ver := split_part(postgis_topology_scripts_installed(), ' ', 1);
-	IF ver != '@EXTVERSION@' THEN
-		RAISE EXCEPTION 'Installed PostGIS Topology version is %', ver
-		USING HINT = 'Try `CREATE EXTENSION postgis_topology VERSION '''
-			|| ver || ''' from unpackaged`,'
-			' or source topology_upgrade.sql`';
-	END IF;
-END;
-$$ LANGUAGE 'plpgsql';
-



More information about the postgis-tickets mailing list