[postgis-tickets] r16738 - Only unpackage raster when needed, and hint about restoring it
Sandro Santilli
strk at kbt.io
Tue Sep 11 02:19:10 PDT 2018
Author: strk
Date: 2018-09-11 02:19:09 -0700 (Tue, 11 Sep 2018)
New Revision: 16738
Added:
trunk/extensions/postgis/unpackage_raster_if_needed.sql
Modified:
trunk/extensions/postgis/Makefile.in
Log:
Only unpackage raster when needed, and hint about restoring it
Modified: trunk/extensions/postgis/Makefile.in
===================================================================
--- trunk/extensions/postgis/Makefile.in 2018-09-11 09:19:03 UTC (rev 16737)
+++ trunk/extensions/postgis/Makefile.in 2018-09-11 09:19:09 UTC (rev 16738)
@@ -41,9 +41,9 @@
# NOTE: order matters
EXTENSION_UPGRADE_SCRIPTS = \
../postgis_extension_helper.sql \
+ sql/raster_unpackage.sql \
sql/postgis_upgrade.sql \
../../doc/postgis_comments.sql \
- sql/raster_unpackage.sql \
../postgis_extension_helper_uninstall.sql
# Scripts making up the extension upgrade-from-unpackaged file
@@ -80,11 +80,16 @@
$(RASTER_DROP_SCRIPTS):
$(MAKE) -C ../../raster
-sql/raster_unpackage.sql: $(RASTER_DROP_SCRIPTS) ../../utils/create_extension_unpackage.pl Makefile | sql
+sql/raster_unpackage.sql: ../../utils/create_extension_unpackage.pl Makefile
+sql/raster_unpackage.sql: $(RASTER_DROP_SCRIPTS) | sql
+
+ sed '/UNPACKAGE_CODE/q' unpackage_raster_if_needed.sql > $@
+
cat $(RASTER_DROP_SCRIPTS) \
- | ../../utils/create_extension_unpackage.pl postgis > $@
+ | ../../utils/create_extension_unpackage.pl postgis >> $@
-sql/raster_unpackage.sql: Makefile
+ sed -ne '/UNPACKAGE_CODE/{s///; :a' -e 'n;p;ba' -e '}' \
+ unpackage_raster_if_needed.sql >> $@
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql | sql
cp $< $@
Added: trunk/extensions/postgis/unpackage_raster_if_needed.sql
===================================================================
--- trunk/extensions/postgis/unpackage_raster_if_needed.sql (rev 0)
+++ trunk/extensions/postgis/unpackage_raster_if_needed.sql 2018-09-11 09:19:09 UTC (rev 16738)
@@ -0,0 +1,18 @@
+DO $unpackage_if_needed$
+BEGIN
+ IF EXISTS (
+ select t.typname from pg_depend d, pg_extension e, pg_type t where
+ e.extname = 'postgis' and d.refclassid =
+ 'pg_catalog.pg_extension'::pg_catalog.regclass and d.refobjid = e.oid
+ and d.classid = 'pg_type'::regclass and d.objid = t.oid
+ and t.typname = 'raster'
+ ) THEN
+
+ -- UNPACKAGE_CODE --
+
+ RAISE WARNING 'PostGIS Raster functionality have been unpackaged'
+ USING HINT = 'type `CREATE EXTENSION postgis_raster FROM unpackaged` to re-package';
+ END IF;
+END
+$unpackage_if_needed$ LANGUAGE 'plpgsql';
+
More information about the postgis-tickets
mailing list