[postgis-tickets] r15937 - Report extension status of postgis from postgis_full_version

Sandro Santilli strk at kbt.io
Sun Oct 8 13:38:06 PDT 2017


Author: strk
Date: 2017-10-08 13:38:06 -0700 (Sun, 08 Oct 2017)
New Revision: 15937

Modified:
   trunk/postgis/postgis.sql.in
Log:
Report extension status of postgis from postgis_full_version

Modified: trunk/postgis/postgis.sql.in
===================================================================
--- trunk/postgis/postgis.sql.in	2017-10-08 19:26:17 UTC (rev 15936)
+++ trunk/postgis/postgis.sql.in	2017-10-08 20:38:06 UTC (rev 15937)
@@ -2814,6 +2814,7 @@
 	sfcgal_scr_ver text;
 	pgsql_scr_ver text;
 	pgsql_ver text;
+	core_is_extension bool;
 BEGIN
 	SELECT @extschema at .postgis_lib_version() INTO libver;
 	SELECT @extschema at .postgis_proj_version() INTO projver;
@@ -2882,6 +2883,16 @@
 
 	fullver = fullver || '"';
 
+	IF EXISTS (
+		SELECT * FROM pg_catalog.pg_extension
+		WHERE extname = 'postgis')
+	THEN
+			fullver = fullver || ' [EXTENSION]';
+			core_is_extension := true;
+	ELSE
+			core_is_extension := false;
+	END IF;
+
 	IF liblwgeomver != relproc THEN
 		fullver = fullver || ' (liblwgeom version mismatch: "' || liblwgeomver || '")';
 	END IF;
@@ -2919,9 +2930,6 @@
 		fullver = fullver || ' LIBPROTOBUF="' || protobuf_lib_ver || '"';
 	END IF;
 
-	-- fullver = fullver || ' DBPROC="' || dbproc || '"';
-	-- fullver = fullver || ' RELPROC="' || relproc || '"';
-
 	IF dbproc != relproc THEN
 		fullver = fullver || ' (core procs from "' || dbproc || '" need upgrade)';
 	END IF;
@@ -2931,6 +2939,12 @@
 		IF topo_scr_ver != relproc THEN
 			fullver = fullver || ' (topology procs from "' || topo_scr_ver || '" need upgrade)';
 		END IF;
+		IF core_is_extension AND NOT EXISTS (
+			SELECT * FROM pg_catalog.pg_extension
+			WHERE extname = 'postgis_topology')
+		THEN
+				fullver = fullver || ' [UNPACKAGED!]';
+		END IF;
 	END IF;
 
 	IF rast_lib_ver IS NOT NULL THEN



More information about the postgis-tickets mailing list