[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0beta2-40-g7d50d1b3c
git at osgeo.org
git at osgeo.org
Fri Aug 5 23:07:14 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, master has been updated
via 7d50d1b3c7e3e41b6b3a066f51270e29d35de1e7 (commit)
from c885bc7b97a33a6888fb0777a6fac64aa993e7f2 (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 7d50d1b3c7e3e41b6b3a066f51270e29d35de1e7
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 master branch (3.3.0dev)
diff --git a/utils/create_upgrade.pl b/utils/create_upgrade.pl
index 2fb2e4705..25635aa02 100755
--- a/utils/create_upgrade.pl
+++ b/utils/create_upgrade.pl
@@ -747,6 +747,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;
@@ -772,17 +774,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/create_upgrade.pl | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list