[postgis-tickets] [SCM] PostGIS branch fix-upgrades-in-absence-of-old-library updated. 3.2.0-265-g23d2064b8

git at osgeo.org git at osgeo.org
Mon Jan 17 05:15:06 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, fix-upgrades-in-absence-of-old-library has been updated
  discards  8b934e52f7ba3e4d6d7244729fa01500f94683cc (commit)
  discards  d026a315be25329e3956e8eda81dd2fe3d080d0c (commit)
  discards  c2804639e68ff446f8e049ee67a611be638d1b64 (commit)
       via  23d2064b8c3b61c78bda4a0d69195b6154b305bb (commit)
       via  e032840ecfe4b8b883551fdb4e0f6eb2ffd96647 (commit)
       via  bf01900ee942146f4acdcab7c87dabf76ad93cea (commit)
       via  2a3c50c4fa9ed9254d7d7cc0f84790281903bd08 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (8b934e52f7ba3e4d6d7244729fa01500f94683cc)
            \
             N -- N -- N (23d2064b8c3b61c78bda4a0d69195b6154b305bb)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 23d2064b8c3b61c78bda4a0d69195b6154b305bb
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Jan 17 14:14:39 2022 +0100

    Put the drop_funtion_if_needed after, rather than before, the upgrade

diff --git a/postgis/postgis_after_upgrade.sql b/postgis/postgis_after_upgrade.sql
index 44772dd0e..a84425621 100644
--- a/postgis/postgis_after_upgrade.sql
+++ b/postgis/postgis_after_upgrade.sql
@@ -247,3 +247,143 @@ IF _postgis_scripts_pgsql_version()::integer >= 96 THEN
 END IF;
 END;
 $$;
+
+-- Helper function to drop functions when they match the full signature
+-- (including parameter names and default values)
+-- Requires schema, name and __exact arguments__ as extracted from pg_catalog.pg_get_function_arguments
+-- You can extract the old function arguments using a query like:
+-- SELECT  p.oid as oid,
+--                 n.nspname as schema,
+--                 p.proname as name,
+--                 pg_catalog.pg_get_function_arguments(p.oid) as arguments
+--         FROM pg_catalog.pg_proc p
+--         LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
+--         WHERE
+--                 LOWER(n.nspname) = LOWER('public') AND
+--                 LOWER(p.proname) = LOWER('ST_AsGeoJson')
+--         ORDER BY 1, 2, 3, 4;
+CREATE OR REPLACE FUNCTION _postgis_drop_function_if_needed(
+	function_name text,
+	function_arguments text) RETURNS void AS $$
+DECLARE
+	frec RECORD;
+	sql_drop text;
+BEGIN
+	FOR frec IN
+		SELECT  p.oid as oid,
+				n.nspname as schema,
+				n.oid as schema_oid,
+				p.proname as name,
+				pg_catalog.pg_get_function_arguments(p.oid) as arguments,
+				pg_catalog.pg_get_function_identity_arguments(p.oid) as identity_arguments
+			FROM pg_catalog.pg_proc p
+			LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
+			WHERE
+				n.oid = (
+					SELECT n.oid
+					FROM pg_proc p
+					JOIN pg_namespace n ON p.pronamespace = n.oid
+					WHERE proname = 'postgis_full_version'
+					) AND
+				LOWER(p.proname) = LOWER(function_name) AND
+				LOWER(pg_catalog.pg_get_function_arguments(p.oid)) ~ LOWER(function_arguments) AND
+				pg_catalog.pg_function_is_visible(p.oid)
+			ORDER BY 1, 2, 4
+	LOOP
+		sql_drop := 'DROP FUNCTION ' || quote_ident(frec.schema) || '.' || quote_ident(frec.name) || ' ( ' || frec.identity_arguments || ' ) ';
+		RAISE DEBUG 'Name (%): %', frec.oid, frec.name;
+		RAISE DEBUG 'Arguments: %', frec.arguments;
+		RAISE DEBUG 'Identity arguments: %', frec.identity_arguments;
+		RAISE DEBUG 'SQL query: %', sql_drop;
+		BEGIN
+			EXECUTE sql_drop;
+		EXCEPTION
+			WHEN OTHERS THEN
+				RAISE EXCEPTION 'Could not drop function %. You might need to drop dependant objects. Postgres error: %', function_name, SQLERRM;
+		END;
+	END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+
+-- FUNCTION AddGeometryColumn signature dropped
+-- (catalog_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer, new_type character varying, new_dim integer, use_typmod boolean)
+SELECT _postgis_drop_function_if_needed
+	(
+	'AddGeometryColumn',
+	'catalog_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer, new_type character varying, new_dim integer, use_typmod boolean'
+	);
+
+-- FUNCTION ST_AsX3D was changed to add versioning for 2.0
+-- (geom geometry, prec integer, options integer)
+SELECT _postgis_drop_function_if_needed
+	(
+	'ST_AsX3D',
+	'geom geometry, prec integer, options integer'
+	);
+
+-- FUNCTION UpdateGeometrySRID changed the name of the args (http://trac.osgeo.org/postgis/ticket/1606) for 2.0
+-- It changed the paramenter `new_srid` to `new_srid_in`
+-- (catalogn_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer)
+-- Dropping it conditionally since the same signature still exists.
+SELECT _postgis_drop_function_if_needed
+	(
+	'UpdateGeometrySRID',
+	'catalogn_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer'
+	);
+
+SELECT _postgis_drop_function_if_needed
+	(
+	'ST_AsLatLonText',
+	'geometry, text'
+	);
+
+-- FUNCTION ST_LineCrossingDirection changed argument names in 3.0
+-- Was (geom1 geometry, geom2 geometry) and now (line1 geometry, line2 geometry)
+SELECT _postgis_drop_function_if_needed
+	(
+	'ST_LineCrossingDirection',
+	'geom1 geometry, geom2 geometry'
+	);
+
+-- FUNCTION _st_linecrossingdirection changed argument names in 3.0
+-- Was (geom1 geometry, geom2 geometry) and now (line1 geometry, line2 geometry)
+SELECT _postgis_drop_function_if_needed
+	(
+	'_ST_LineCrossingDirection',
+	'geom1 geometry, geom2 geometry'
+	);
+
+-- FUNCTION ST_AsGeoJson changed argument names
+-- (pretty_print => pretty_bool) in 3.0alpha4
+SELECT _postgis_drop_function_if_needed
+	(
+	'ST_AsGeoJson',
+	$args$r record, geom_column text DEFAULT ''::text, maxdecimaldigits integer DEFAULT 15, pretty_print boolean DEFAULT false$args$
+	);
+
+-- FUNCTION _st_orderingequals changed argument names in 3.0
+-- Was (GeometryA geometry, GeometryB geometry) and now (geom1 geometry, geom2 geometry)
+SELECT _postgis_drop_function_if_needed
+	(
+	'_st_orderingequals',
+	'GeometryA geometry, GeometryB geometry'
+	);
+
+-- FUNCTION st_orderingequals changed argument names in 3.0
+-- Was (GeometryA geometry, GeometryB geometry) and now (geom1 geometry, geom2 geometry)
+SELECT _postgis_drop_function_if_needed
+	(
+	'st_orderingequals',
+	'GeometryA geometry, GeometryB geometry'
+	);
+
+-- FUNCTION st_tileenvelope added a new default argument in 3.1
+SELECT _postgis_drop_function_if_needed
+    (
+    'st_tileenvelope',
+    'zoom integer, x integer, y integer, bounds geometry DEFAULT ''0102000020110F00000200000052107C45F81B73C152107C45F81B73C152107C45F81B734152107C45F81B7341''::geometry'
+    );
+
+-- DROP auxiliar function (created above)
+DROP FUNCTION _postgis_drop_function_if_needed(text, text);
diff --git a/postgis/postgis_before_upgrade.sql b/postgis/postgis_before_upgrade.sql
index ea84c524f..48f283848 100644
--- a/postgis/postgis_before_upgrade.sql
+++ b/postgis/postgis_before_upgrade.sql
@@ -20,89 +20,6 @@
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
 
--- Helper function to drop functions when they match the full signature
--- Requires schema, name and __exact arguments__ as extracted from pg_catalog.pg_get_function_arguments
--- You can extract the old function arguments using a query like:
--- SELECT  p.oid as oid,
---                 n.nspname as schema,
---                 p.proname as name,
---                 pg_catalog.pg_get_function_arguments(p.oid) as arguments
---         FROM pg_catalog.pg_proc p
---         LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
---         WHERE
---                 LOWER(n.nspname) = LOWER('public') AND
---                 LOWER(p.proname) = LOWER('ST_AsGeoJson')
---         ORDER BY 1, 2, 3, 4;
-CREATE OR REPLACE FUNCTION _postgis_drop_function_if_needed(
-	function_name text,
-	function_arguments text) RETURNS void AS $$
-DECLARE
-	frec RECORD;
-	sql_drop text;
-BEGIN
-	FOR frec IN
-		SELECT  p.oid as oid,
-				n.nspname as schema,
-				n.oid as schema_oid,
-				p.proname as name,
-				pg_catalog.pg_get_function_arguments(p.oid) as arguments,
-				pg_catalog.pg_get_function_identity_arguments(p.oid) as identity_arguments
-			FROM pg_catalog.pg_proc p
-			LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
-			WHERE
-				n.oid = (
-					SELECT n.oid
-					FROM pg_proc p
-					JOIN pg_namespace n ON p.pronamespace = n.oid
-					WHERE proname = 'postgis_full_version'
-					) AND
-				LOWER(p.proname) = LOWER(function_name) AND
-				LOWER(pg_catalog.pg_get_function_arguments(p.oid)) ~ LOWER(function_arguments) AND
-				pg_catalog.pg_function_is_visible(p.oid)
-			ORDER BY 1, 2, 4
-	LOOP
-		sql_drop := 'DROP FUNCTION ' || quote_ident(frec.schema) || '.' || quote_ident(frec.name) || ' ( ' || frec.identity_arguments || ' ) ';
-		RAISE DEBUG 'Name (%): %', frec.oid, frec.name;
-		RAISE DEBUG 'Arguments: %', frec.arguments;
-		RAISE DEBUG 'Identity arguments: %', frec.identity_arguments;
-		RAISE DEBUG 'SQL query: %', sql_drop;
-		BEGIN
-			EXECUTE sql_drop;
-		EXCEPTION
-			WHEN OTHERS THEN
-				RAISE EXCEPTION 'Could not drop function %. You might need to drop dependant objects. Postgres error: %', function_name, SQLERRM;
-		END;
-	END LOOP;
-END;
-$$ LANGUAGE plpgsql;
-
-
--- FUNCTION AddGeometryColumn signature dropped
--- (catalog_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer, new_type character varying, new_dim integer, use_typmod boolean)
-SELECT _postgis_drop_function_if_needed
-	(
-	'AddGeometryColumn',
-	'catalog_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer, new_type character varying, new_dim integer, use_typmod boolean'
-	);
-
--- FUNCTION ST_AsX3D was changed to add versioning for 2.0
--- (geom geometry, prec integer, options integer)
-SELECT _postgis_drop_function_if_needed
-	(
-	'ST_AsX3D',
-	'geom geometry, prec integer, options integer'
-	);
-
--- FUNCTION UpdateGeometrySRID changed the name of the args (http://trac.osgeo.org/postgis/ticket/1606) for 2.0
--- It changed the paramenter `new_srid` to `new_srid_in`
--- (catalogn_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer)
--- Dropping it conditionally since the same signature still exists.
-SELECT _postgis_drop_function_if_needed
-	(
-	'UpdateGeometrySRID',
-	'catalogn_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer'
-	);
-
 
 --deprecated and removed in 2.1
 -- Hack to fix 2.0 naming
@@ -141,60 +58,6 @@ $$ ;
 -- FUNCTION ST_AsLatLonText went from multiple signatures to a single one with defaults for 2.2.0
 DROP FUNCTION IF EXISTS ST_AsLatLonText(geometry); -- Does not conflict
 
-SELECT _postgis_drop_function_if_needed
-	(
-	'ST_AsLatLonText',
-	'geometry, text'
-	);
-
--- FUNCTION ST_LineCrossingDirection changed argument names in 3.0
--- Was (geom1 geometry, geom2 geometry) and now (line1 geometry, line2 geometry)
-SELECT _postgis_drop_function_if_needed
-	(
-	'ST_LineCrossingDirection',
-	'geom1 geometry, geom2 geometry'
-	);
-
--- FUNCTION _st_linecrossingdirection changed argument names in 3.0
--- Was (geom1 geometry, geom2 geometry) and now (line1 geometry, line2 geometry)
-SELECT _postgis_drop_function_if_needed
-	(
-	'_ST_LineCrossingDirection',
-	'geom1 geometry, geom2 geometry'
-	);
-
--- FUNCTION ST_AsGeoJson changed argument names
--- (pretty_print => pretty_bool) in 3.0alpha4
-SELECT _postgis_drop_function_if_needed
-	(
-	'ST_AsGeoJson',
-	$args$r record, geom_column text DEFAULT ''::text, maxdecimaldigits integer DEFAULT 15, pretty_print boolean DEFAULT false$args$
-	);
-
--- FUNCTION _st_orderingequals changed argument names in 3.0
--- Was (GeometryA geometry, GeometryB geometry) and now (geom1 geometry, geom2 geometry)
-SELECT _postgis_drop_function_if_needed
-	(
-	'_st_orderingequals',
-	'GeometryA geometry, GeometryB geometry'
-	);
-
--- FUNCTION st_orderingequals changed argument names in 3.0
--- Was (GeometryA geometry, GeometryB geometry) and now (geom1 geometry, geom2 geometry)
-SELECT _postgis_drop_function_if_needed
-	(
-	'st_orderingequals',
-	'GeometryA geometry, GeometryB geometry'
-	);
-
--- FUNCTION st_tileenvelope added a new default argument in 3.1
-SELECT _postgis_drop_function_if_needed
-    (
-    'st_tileenvelope',
-    'zoom integer, x integer, y integer, bounds geometry DEFAULT ''0102000020110F00000200000052107C45F81B73C152107C45F81B73C152107C45F81B734152107C45F81B7341''::geometry'
-    );
-
-
 -- FUNCTION st_buffer changed to add defaults in 3.0
 -- This signature was superseeded
 DROP FUNCTION IF EXISTS st_buffer(geometry, double precision); -- Does not conflict
@@ -244,6 +107,4 @@ END;
 $$;
 
 
--- DROP auxiliar function (created above)
-DROP FUNCTION _postgis_drop_function_if_needed(text, text);
 

commit e032840ecfe4b8b883551fdb4e0f6eb2ffd96647
Author: Sandro Santilli <strk at kbt.io>
Date:   Sat Jan 15 18:54:37 2022 +0100

    Do not keep geometry_out functional during upgrade tests
    
    This is meant to reproduce the bug reported in ticket 5046

diff --git a/regress/hooks/hook-before-upgrade.sql b/regress/hooks/hook-before-upgrade.sql
index 2dcddaf4b..d7ed853ca 100644
--- a/regress/hooks/hook-before-upgrade.sql
+++ b/regress/hooks/hook-before-upgrade.sql
@@ -82,5 +82,5 @@ UPDATE pg_proc SET probin = probin || '-uninstalled' WHERE probin like '%postgis
 -- makes pg_get_function_arguments choke. This should be fixed!
 -- See https://trac.osgeo.org/postgis/ticket/5046#comment:5
 -- When ticket #5046 is fixed we can ALSO break geometry_out
-AND proname NOT IN ( 'geometry_out')
+--AND proname NOT IN ( 'geometry_out')
 ;

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

Summary of changes:
 doc/po/it_IT/postgis.xml.po        |  22 +++---
 postgis/postgis_after_upgrade.sql  | 140 +++++++++++++++++++++++++++++++++++++
 postgis/postgis_before_upgrade.sql | 139 ------------------------------------
 3 files changed, 153 insertions(+), 148 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list