]> granicus.if.org Git - postgis/commitdiff
fix regex check of _postgis_pgsql_version() to correctly detect postgresql 10+ versi...
authorRegina Obe <lr@pcorp.us>
Tue, 5 Sep 2017 19:47:36 +0000 (19:47 +0000)
committerRegina Obe <lr@pcorp.us>
Tue, 5 Sep 2017 19:47:36 +0000 (19:47 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@15628 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/postgis.sql.in

index 30fa89e78e015f69acfb415b2160ac1b46a32865..d0fc5fb0df524713e3857b505069815fd5796be6 100644 (file)
@@ -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