[postgis-tickets] r17181 - Use `server_version_num` instead of parsing `version()`
Raul
raul at rmr.ninja
Fri Jan 18 09:25:55 PST 2019
Author: algunenano
Date: 2019-01-18 09:25:55 -0800 (Fri, 18 Jan 2019)
New Revision: 17181
Modified:
trunk/NEWS
trunk/extensions/postgis_extension_helper.sql
trunk/postgis/postgis.sql.in
Log:
Use `server_version_num` instead of parsing `version()`
Closes #4296
Closes https://github.com/postgis/postgis/pull/363
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2019-01-18 17:24:55 UTC (rev 17180)
+++ trunk/NEWS 2019-01-18 17:25:55 UTC (rev 17181)
@@ -67,6 +67,7 @@
(Darafei Praliaskouski)
- #4289, ST_AsMVTGeom: Transform coordinates space before clipping (Raúl Marín)
- #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.5.0
Modified: trunk/extensions/postgis_extension_helper.sql
===================================================================
--- trunk/extensions/postgis_extension_helper.sql 2019-01-18 17:24:55 UTC (rev 17180)
+++ trunk/extensions/postgis_extension_helper.sql 2019-01-18 17:25:55 UTC (rev 17181)
@@ -28,8 +28,7 @@
var_class text := '';
var_is_aggregate boolean := false;
var_sql_list text := '';
- var_pgsql_version integer := 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;
+ var_pgsql_version integer := current_setting('server_version_num');
BEGIN
var_class := CASE WHEN lower(param_type) = 'function' OR lower(param_type) = 'aggregate' THEN 'pg_proc' ELSE '' END;
var_is_aggregate := CASE WHEN lower(param_type) = 'aggregate' THEN true ELSE false END;
Modified: trunk/postgis/postgis.sql.in
===================================================================
--- trunk/postgis/postgis.sql.in 2019-01-18 17:24:55 UTC (rev 17180)
+++ trunk/postgis/postgis.sql.in 2019-01-18 17:25:55 UTC (rev 17181)
@@ -2854,8 +2854,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;
-- Availability: 2.5.0
More information about the postgis-tickets
mailing list