[postgis-tickets] [SCM] PostGIS branch stable-3.2 updated. 3.2.2-9-ga04d348ca
git at osgeo.org
git at osgeo.org
Fri Aug 5 23:25:35 PDT 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, stable-3.2 has been updated
via a04d348ca58be6f161206ad38f432b8462275817 (commit)
from 1f3c83b49f36cb882f3712ca5cb836e098016653 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a04d348ca58be6f161206ad38f432b8462275817
Author: Sandro Santilli <strk at kbt.io>
Date: Sat Aug 6 07:52:48 2022 +0200
Fix extraction of integer array version on upgrade
References #5202 in 3.2 branch (3.2.3dev)
diff --git a/utils/postgis_proc_upgrade.pl b/utils/postgis_proc_upgrade.pl
index 028535a05..f58d9aa34 100755
--- a/utils/postgis_proc_upgrade.pl
+++ b/utils/postgis_proc_upgrade.pl
@@ -697,6 +697,8 @@ DO $$
DECLARE
old_scripts text;
new_scripts text;
+ old_ver_int int[];
+ new_ver_int int[];
old_maj text;
new_maj text;
postgis_upgrade_info RECORD;
@@ -722,17 +724,34 @@ BEGIN
END;
SELECT into new_scripts 'NEWVERSION';
- -- Guard against downgrade
- IF
- pg_catalog.string_to_array(
- pg_catalog.regexp_replace(new_scripts, '(dev|alpha|beta)[0-9]*', ''),
+ BEGIN
+ new_ver_int := pg_catalog.string_to_array(
+ pg_catalog.regexp_replace(
+ new_scripts,
+ '[^\d.].*',
+ ''
+ ),
'.'
- )::int[]
- <
- pg_catalog.string_to_array(
- pg_catalog.regexp_replace(old_scripts, '(dev|alpha|beta)[0-9]*', ''),
+ )::int[];
+ EXCEPTION WHEN OTHERS THEN
+ RAISE EXCEPTION 'Cannot parse new version % into integers', new_scripts;
+ END;
+
+ BEGIN
+ old_ver_int := pg_catalog.string_to_array(
+ pg_catalog.regexp_replace(
+ old_scripts,
+ '[^\d.].*',
+ ''
+ ),
'.'
- )::int[]
+ )::int[];
+ EXCEPTION WHEN OTHERS THEN
+ RAISE EXCEPTION 'Cannot parse old version % into integers', old_scripts;
+ END;
+
+ -- Guard against downgrade
+ IF new_ver_int < old_ver_int
THEN
RAISE EXCEPTION 'Downgrade of MODULE from version % to version % is forbidden', old_scripts, new_scripts;
END IF;
-----------------------------------------------------------------------
Summary of changes:
utils/postgis_proc_upgrade.pl | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list