[postgis-tickets] r15628 - fix regex check of _postgis_pgsql_version() to correctly detect postgresql 10+ version number
Regina Obe
lr at pcorp.us
Tue Sep 5 12:47:36 PDT 2017
Author: robe
Date: 2017-09-05 12:47:36 -0700 (Tue, 05 Sep 2017)
New Revision: 15628
Modified:
trunk/postgis/postgis.sql.in
Log:
fix regex check of _postgis_pgsql_version() to correctly detect postgresql 10+ version number
Modified: trunk/postgis/postgis.sql.in
===================================================================
--- trunk/postgis/postgis.sql.in 2017-09-05 16:58:11 UTC (rev 15627)
+++ trunk/postgis/postgis.sql.in 2017-09-05 19:47:36 UTC (rev 15628)
@@ -2778,7 +2778,8 @@
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
More information about the postgis-tickets
mailing list