[postgis-tickets] r17178 - Use `server_version_num` instead of parsing `version()`

Raul raul at rmr.ninja
Fri Jan 18 09:24:12 PST 2019


Author: algunenano
Date: 2019-01-18 09:24:12 -0800 (Fri, 18 Jan 2019)
New Revision: 17178

Modified:
   branches/2.3/NEWS
   branches/2.3/postgis/postgis.sql.in
Log:
Use `server_version_num` instead of parsing `version()`

References #4296


Modified: branches/2.3/NEWS
===================================================================
--- branches/2.3/NEWS	2019-01-18 16:07:59 UTC (rev 17177)
+++ branches/2.3/NEWS	2019-01-18 17:24:12 UTC (rev 17178)
@@ -13,6 +13,8 @@
 
   - #4275, Avoid passing a NULL pointer to GEOSisEmpty (Raúl Marín)
 
+  - #4296, Use `server_version_num` instead of parsing `version()` (Raúl Marín)
+
 PostGIS 2.3.8
 2018/11/24
 

Modified: branches/2.3/postgis/postgis.sql.in
===================================================================
--- branches/2.3/postgis/postgis.sql.in	2019-01-18 16:07:59 UTC (rev 17177)
+++ branches/2.3/postgis/postgis.sql.in	2019-01-18 17:24:12 UTC (rev 17178)
@@ -2848,8 +2848,7 @@
 
 CREATE OR REPLACE FUNCTION _postgis_pgsql_version() RETURNS text
 AS $$
-	SELECT CASE WHEN split_part(s,'.',1)::integer > 9 THEN split_part(s,'.',1) || '0' ELSE split_part(s,'.', 1) || split_part(s,'.', 2) END AS v
-	FROM substring(version(), 'PostgreSQL ([0-9\.]+)') AS s;
+	SELECT current_setting('server_version_num');
 $$ LANGUAGE 'sql' STABLE;
 
 CREATE OR REPLACE FUNCTION postgis_full_version() RETURNS text



More information about the postgis-tickets mailing list