From: Sandro Santilli Date: Thu, 26 Oct 2017 06:46:50 +0000 (+0000) Subject: Upgrade during create extension from unpackaged X-Git-Tag: 2.5.0alpha~346 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8afbf2bc77f5102b6e3ded6ce73f3a1293b5ede0;p=postgis Upgrade during create extension from unpackaged This commit does it for "postgis" and "postgis_topology" extensions. Closes #3913 git-svn-id: http://svn.osgeo.org/postgis/trunk@16063 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/.gitignore b/.gitignore index 471486a13..984552aac 100644 --- a/.gitignore +++ b/.gitignore @@ -48,7 +48,6 @@ extensions/address_standardizer/results/ 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.sql.in 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 diff --git a/NEWS b/NEWS index 4b7304710..93da67373 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ PostGIS 2.5.0 - #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 @@ PostGIS 2.5.0 - 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) diff --git a/extensions/postgis/Makefile.in b/extensions/postgis/Makefile.in index e6e00d95d..6fb1456a2 100644 --- a/extensions/postgis/Makefile.in +++ b/extensions/postgis/Makefile.in @@ -79,9 +79,9 @@ $(EXTENSION).control: $(EXTENSION).control.in Makefile 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 \ >> $@ diff --git a/extensions/postgis/unpackaged_check.sql.in b/extensions/postgis/unpackaged_check.sql.in deleted file mode 100644 index 19152f673..000000000 --- a/extensions/postgis/unpackaged_check.sql.in +++ /dev/null @@ -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'; - diff --git a/extensions/postgis_topology/Makefile.in b/extensions/postgis_topology/Makefile.in index 2c234852b..3e1e1dc89 100644 --- a/extensions/postgis_topology/Makefile.in +++ b/extensions/postgis_topology/Makefile.in @@ -60,17 +60,12 @@ sql_bits/topology.sql: ../../topology/topology.sql 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 diff --git a/extensions/postgis_topology/unpackaged_check.sql.in b/extensions/postgis_topology/unpackaged_check.sql.in deleted file mode 100644 index 8b89498de..000000000 --- a/extensions/postgis_topology/unpackaged_check.sql.in +++ /dev/null @@ -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'; -