[postgis-tickets] r17149 - postgis_full_version: Reduce raster notices to debug

Raul raul at rmr.ninja
Tue Jan 15 02:23:52 PST 2019


Author: algunenano
Date: 2019-01-15 02:23:51 -0800 (Tue, 15 Jan 2019)
New Revision: 17149

Modified:
   trunk/postgis/postgis.sql.in
Log:
postgis_full_version: Reduce raster notices to debug

Closes #4297


Modified: trunk/postgis/postgis.sql.in
===================================================================
--- trunk/postgis/postgis.sql.in	2019-01-14 18:02:29 UTC (rev 17148)
+++ trunk/postgis/postgis.sql.in	2019-01-15 10:23:51 UTC (rev 17149)
@@ -2943,7 +2943,7 @@
 END
 $$ LANGUAGE plpgsql VOLATILE;
 
--- Changed: 2.4.0
+-- Changed: 3.0.0
 CREATE OR REPLACE FUNCTION postgis_full_version() RETURNS text
 AS $$
 DECLARE
@@ -2952,16 +2952,15 @@
 	projver text;
 	geosver text;
 	sfcgalver text;
-	cgalver text;
-	gdalver text;
+	gdalver text := NULL;
 	libxmlver text;
 	liblwgeomver text;
 	dbproc text;
 	relproc text;
 	fullver text;
-	rast_lib_ver text;
-	rast_scr_ver text;
-	topo_scr_ver text;
+	rast_lib_ver text := NULL;
+	rast_scr_ver text := NULL;
+	topo_scr_ver text := NULL;
 	json_lib_ver text;
 	protobuf_lib_ver text;
 	sfcgal_lib_ver text;
@@ -2981,31 +2980,29 @@
 		SELECT @extschema at .postgis_gdal_version() INTO gdalver;
 	EXCEPTION
 		WHEN undefined_function THEN
-			gdalver := NULL;
-			RAISE NOTICE 'Function postgis_gdal_version() not found.  Is raster support enabled and rtpostgis.sql installed?';
+			RAISE DEBUG 'Function postgis_gdal_version() not found.  Is raster support enabled and rtpostgis.sql installed?';
 	END;
 	BEGIN
 		SELECT @extschema at .postgis_sfcgal_version() INTO sfcgalver;
-    BEGIN
-      SELECT @extschema at .postgis_sfcgal_scripts_installed() INTO sfcgal_scr_ver;
-    EXCEPTION
-      WHEN undefined_function THEN
-        sfcgal_scr_ver := 'missing';
-    END;
+		BEGIN
+			SELECT @extschema at .postgis_sfcgal_scripts_installed() INTO sfcgal_scr_ver;
+		EXCEPTION
+			WHEN undefined_function THEN
+				sfcgal_scr_ver := 'missing';
+		END;
 	EXCEPTION
 		WHEN undefined_function THEN
-			sfcgalver := NULL;
+			RAISE DEBUG 'Function postgis_sfcgal_scripts_installed() not found. Is sfcgal support enabled and sfcgal.sql installed?';
 	END;
 	SELECT @extschema at .postgis_liblwgeom_version() INTO liblwgeomver;
 	SELECT @extschema at .postgis_libxml_version() INTO libxmlver;
 	SELECT @extschema at .postgis_scripts_installed() INTO dbproc;
 	SELECT @extschema at .postgis_scripts_released() INTO relproc;
-	select @extschema at .postgis_svn_version() INTO svnver;
+	SELECT @extschema at .postgis_svn_version() INTO svnver;
 	BEGIN
 		SELECT topology.postgis_topology_scripts_installed() INTO topo_scr_ver;
 	EXCEPTION
 		WHEN undefined_function OR invalid_schema_name THEN
-			topo_scr_ver := NULL;
 			RAISE DEBUG 'Function postgis_topology_scripts_installed() not found. Is topology support enabled and topology.sql installed?';
 		WHEN insufficient_privilege THEN
 			RAISE NOTICE 'Topology support cannot be inspected. Is current user granted USAGE on schema "topology" ?';
@@ -3017,8 +3014,9 @@
 		SELECT postgis_raster_scripts_installed() INTO rast_scr_ver;
 	EXCEPTION
 		WHEN undefined_function THEN
-			rast_scr_ver := NULL;
-			RAISE NOTICE 'Function postgis_raster_scripts_installed() not found. Is raster support enabled and rtpostgis.sql installed?';
+			RAISE DEBUG 'Function postgis_raster_scripts_installed() not found. Is raster support enabled and rtpostgis.sql installed?';
+		WHEN OTHERS THEN
+			RAISE NOTICE 'Function postgis_raster_scripts_installed() could not be called: % (%)', SQLERRM, SQLSTATE;
 	END;
 
 	BEGIN
@@ -3025,8 +3023,9 @@
 		SELECT @extschema at .postgis_raster_lib_version() INTO rast_lib_ver;
 	EXCEPTION
 		WHEN undefined_function THEN
-			rast_lib_ver := NULL;
-			RAISE NOTICE 'Function postgis_raster_lib_version() not found. Is raster support enabled and rtpostgis.sql installed?';
+			RAISE DEBUG 'Function postgis_raster_lib_version() not found. Is raster support enabled and rtpostgis.sql installed?';
+		WHEN OTHERS THEN
+			RAISE NOTICE 'Function postgis_raster_lib_version() could not be called: % (%)', SQLERRM, SQLSTATE;
 	END;
 
 	fullver = 'POSTGIS="' || libver;
@@ -3119,7 +3118,7 @@
 	END IF;
 
 	IF sfcgal_scr_ver IS NOT NULL AND sfcgal_scr_ver != relproc THEN
-    fullver = fullver || ' (sfcgal procs from "' || sfcgal_scr_ver || '" need upgrade)';
+		fullver = fullver || ' (sfcgal procs from "' || sfcgal_scr_ver || '" need upgrade)';
 	END IF;
 
 	RETURN fullver;



More information about the postgis-tickets mailing list