[postgis-tickets] r16049 - Check unpackaged version for topology too
Sandro Santilli
strk at kbt.io
Sun Oct 22 12:06:49 PDT 2017
Author: strk
Date: 2017-10-22 12:06:49 -0700 (Sun, 22 Oct 2017)
New Revision: 16049
Added:
trunk/extensions/postgis_topology/unpackaged_check.sql.in
Modified:
trunk/extensions/postgis_topology/Makefile.in
Log:
Check unpackaged version for topology too
See #3892
Modified: trunk/extensions/postgis_topology/Makefile.in
===================================================================
--- trunk/extensions/postgis_topology/Makefile.in 2017-10-22 19:00:29 UTC (rev 16048)
+++ trunk/extensions/postgis_topology/Makefile.in 2017-10-22 19:06:49 UTC (rev 16049)
@@ -55,10 +55,17 @@
sql_bits/topology_comments.sql: ../../doc/topology_comments.sql
cp $< $@
-sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: ../../topology/topology.sql ../../utils/create_unpackaged.pl
+sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: ../../topology/topology.sql ../../utils/create_unpackaged.pl unpackaged_check.sql Makefile
mkdir -p sql
- cat $< | $(PERL) ../../utils/create_unpackaged.pl postgis_topology > $@
+ # Ensure version is correct
+ cat unpackaged_check.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
Added: trunk/extensions/postgis_topology/unpackaged_check.sql.in
===================================================================
--- trunk/extensions/postgis_topology/unpackaged_check.sql.in (rev 0)
+++ trunk/extensions/postgis_topology/unpackaged_check.sql.in 2017-10-22 19:06:49 UTC (rev 16049)
@@ -0,0 +1,14 @@
+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