Skip to content

Commit c94f623

Browse files
committed
Use escape strings for version regexes
Make the PostGIS script-version comparison helper and its regression checks independent of standard_conforming_strings. This avoids warnings during install when standard_conforming_strings is off, which the regression harness treats as load failure.\n\nCloses #2808
1 parent f82a101 commit c94f623

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

postgis/postgis.sql.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3161,7 +3161,7 @@ CREATE OR REPLACE FUNCTION _postgis_scripts_version_cmp_key(ver text)
31613161
BEGIN
31623162
ver_match := pg_catalog.regexp_match(
31633163
pg_catalog.lower(ver),
3164-
'^([0-9]+)\.([0-9]+)\.([0-9]+)(dev|alpha|beta|rc)?([0-9]*)([^0-9a-z].*)?$'
3164+
E'^([0-9]+)\\.([0-9]+)\\.([0-9]+)(dev|alpha|beta|rc)?([0-9]*)([^0-9a-z].*)?$'
31653165
);
31663166
IF ver_match IS NULL THEN
31673167
RETURN NULL;

regress/core/postgis_full_version.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LANGUAGE 'sql' IMMUTABLE;
2525
-- Older component script versions still mean the installed procs need upgrade.
2626
SELECT 'topology_old_scripts',
2727
postgis_full_version() ~
28-
'TOPOLOGY \(topology procs from "1\.0\.0" need upgrade\)';
28+
E'TOPOLOGY \\(topology procs from "1\\.0\\.0" need upgrade\\)';
2929

3030
CREATE OR REPLACE FUNCTION topology.postgis_topology_scripts_installed()
3131
RETURNS text
@@ -52,17 +52,17 @@ LANGUAGE 'sql' IMMUTABLE;
5252
-- includes final releases newer than release candidates and later RCs.
5353
SELECT 'topology_newer_scripts',
5454
postgis_full_version() ~
55-
'TOPOLOGY \(topology procs from "3\.7\.0" are newer than core procs from "3\.7\.0rc1"\)';
55+
E'TOPOLOGY \\(topology procs from "3\\.7\\.0" are newer than core procs from "3\\.7\\.0rc1"\\)';
5656

5757
SELECT 'raster_newer_scripts',
5858
postgis_full_version() ~
59-
'\(raster procs from "3\.7\.0rc2" are newer than core procs from "3\.7\.0rc1"\)';
59+
E'\\(raster procs from "3\\.7\\.0rc2" are newer than core procs from "3\\.7\\.0rc1"\\)';
6060

6161
-- A prerelease older than the core prerelease is still reported as needing
6262
-- upgrade, even when its numeric major/minor/micro components match.
6363
SELECT 'sfcgal_older_prerelease',
6464
postgis_full_version() ~
65-
'\(sfcgal procs from "3\.7\.0beta1" need upgrade\)';
65+
E'\\(sfcgal procs from "3\\.7\\.0beta1" need upgrade\\)';
6666

6767
CREATE OR REPLACE FUNCTION postgis_sfcgal_scripts_installed()
6868
RETURNS text
@@ -71,6 +71,6 @@ LANGUAGE 'sql' IMMUTABLE;
7171

7272
SELECT 'sfcgal_newer_scripts',
7373
postgis_full_version() ~
74-
'\(sfcgal procs from "3\.7\.0" are newer than core procs from "3\.7\.0rc1"\)';
74+
E'\\(sfcgal procs from "3\\.7\\.0" are newer than core procs from "3\\.7\\.0rc1"\\)';
7575

7676
ROLLBACK;

0 commit comments

Comments
 (0)