From: Regina Obe Date: Tue, 5 Sep 2017 19:47:36 +0000 (+0000) Subject: fix regex check of _postgis_pgsql_version() to correctly detect postgresql 10+ versi... X-Git-Tag: 2.4.0rc1~68 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2fe9cccbb4ee35980c07a1a9aa9788db325e4101;p=postgis fix regex check of _postgis_pgsql_version() to correctly detect postgresql 10+ version number git-svn-id: http://svn.osgeo.org/postgis/trunk@15628 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in index 30fa89e78..d0fc5fb0d 100644 --- a/postgis/postgis.sql.in +++ b/postgis/postgis.sql.in @@ -2778,7 +2778,8 @@ CREATE OR REPLACE FUNCTION _postgis_scripts_pgsql_version() RETURNS text CREATE OR REPLACE FUNCTION _postgis_pgsql_version() RETURNS text AS $$ - select regexp_replace(version(), 'PostgreSQL ([^.]*)\.([^\.]*).* on .*', E'\\1\\2'); + 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; $$ LANGUAGE 'sql' STABLE; CREATE OR REPLACE FUNCTION postgis_full_version() RETURNS text