Commit 5affb213 authored by Raúl Marín's avatar Raúl Marín

Use `server_version_num` instead of parsing `version()`

References #4296


git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@17180 b70326c6-7e19-0410-871a-916f4a2858ee
parent 9e895546
Pipeline #43916454 passed with stage
in 23 minutes and 9 seconds
......@@ -40,6 +40,8 @@ XXXX/XX/XX
- #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.1
2018/11/18
......
......@@ -28,8 +28,7 @@ DECLARE
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;
......
......@@ -2808,8 +2808,7 @@ CREATE OR REPLACE FUNCTION _postgis_scripts_pgsql_version() RETURNS text
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment