[postgis-tickets] [SCM] PostGIS branch master updated. 3.2.0-502-gcff010336

git at osgeo.org git at osgeo.org
Sun Feb 6 12:20:28 PST 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  cff01033637ddcf984d12edbbecc9f70b0e4de4e (commit)
      from  5f8782f02d7533cf5e947f65e8c6d05ed8be5e1d (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 cff01033637ddcf984d12edbbecc9f70b0e4de4e
Author: Sandro Santilli <strk at kbt.io>
Date:   Sat Feb 5 01:27:06 2022 +0100

    Have postgis_extensions_upgrade set extversion to ANY prior to update
    
    This allows upgrading from any version of PostGIS even if no
    specific upgrade script exists on disk (which often happens as
    we support multiple stable branches).

diff --git a/NEWS b/NEWS
index 5d22df3aa..5a13ae0a7 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PostGIS 3.3.0dev
   - ...
 
  * Enhancements *
+  - postgis_extensions_upgrade() support for upgrades from any PostGIS
+    version, including yet to be released ones (Sandro Santilli)
   - #5037, add convexhull 3D (Loïc Bartoletti)
   - #5040, add postgis_sfcgal_full_version (Loïc Bartoletti)
   - GH655, GiST: balance the tree splits better in recursive calls (Darafei Praliaskouski)
diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in
index d3450bbf2..a6c2060d9 100644
--- a/postgis/postgis.sql.in
+++ b/postgis/postgis.sql.in
@@ -3034,28 +3034,16 @@ BEGIN
 			ELSE
 				RAISE DEBUG 'Skipping % (not in use)', rec.name;
 			END IF;
-		ELSIF target_version != rec.installed_version
-		THEN --}{
-			sql = 'ALTER EXTENSION ' || rec.name || ' UPDATE TO ' ||
-						quote_ident(target_version)   || ';';
+		ELSE -- IF target_version != rec.installed_version THEN --}{
+			sql = format(
+				'UPDATE pg_catalog.pg_extension SET extversion = ''ANY'' WHERE extname = %1$L;'
+				'ALTER EXTENSION %1$I UPDATE TO %2$I',
+				rec.name, target_version
+			);
 			RAISE NOTICE 'Updating extension % %',
 				rec.name, rec.installed_version;
 			RAISE DEBUG '%', sql;
 			EXECUTE sql;
-		ELSIF (target_version = rec.installed_version AND rec.installed_version ILIKE '%dev') OR
-			(@extschema at ._postgis_pgsql_version() != @extschema at ._postgis_scripts_pgsql_version())
-		THEN --}{
-			-- we need to upgrade to next and back
-			RAISE NOTICE 'Updating extension % % (self refresh)',
-				rec.name, rec.installed_version;
-			sql = 'ALTER EXTENSION ' || rec.name || ' UPDATE TO ' ||
-						quote_ident(target_version || 'next')   || ';';
-			RAISE DEBUG '%', sql;
-			EXECUTE sql;
-			sql = 'ALTER EXTENSION ' || rec.name || ' UPDATE TO ' ||
-						quote_ident(target_version)   || ';';
-			RAISE DEBUG '%', sql;
-			EXECUTE sql;
 		END IF; --}
 
 	END LOOP; --}

-----------------------------------------------------------------------

Summary of changes:
 NEWS                   |  2 ++
 postgis/postgis.sql.in | 24 ++++++------------------
 2 files changed, 8 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list