[postgis-tickets] [SCM] PostGIS branch master updated. 3.4.0rc1-91-g3a831d5c6
git at osgeo.org
git at osgeo.org
Thu Aug 31 14:20:45 PDT 2023
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 3a831d5c6ccde943da253e6ca932c483d4179348 (commit)
via 49ddd911f69b7843bda7a8c06c44bf3de91f20b5 (commit)
from e1a3381fa706532b54108a762df6129d0aedce4e (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 3a831d5c6ccde943da253e6ca932c483d4179348
Author: Sandro Santilli <strk at kbt.io>
Date: Thu Aug 31 21:02:48 2023 +0200
Add common function to drop by signature rather than identity
diff --git a/postgis/common_after_upgrade.sql b/postgis/common_after_upgrade.sql
index 45873e722..09f9ea2a4 100644
--- a/postgis/common_after_upgrade.sql
+++ b/postgis/common_after_upgrade.sql
@@ -19,7 +19,8 @@
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- DROP auxiliar function (created by common_before_upgrade.sql)
-DROP FUNCTION _postgis_drop_function_if_needed(text, text, text);
+DROP FUNCTION _postgis_drop_function_by_identity(text, text, text);
+DROP FUNCTION _postgis_drop_function_by_signature(text, text);
-- Drop deprecated functions if possible
diff --git a/postgis/common_before_upgrade.sql b/postgis/common_before_upgrade.sql
index 210ca0ab9..a6389faef 100644
--- a/postgis/common_before_upgrade.sql
+++ b/postgis/common_before_upgrade.sql
@@ -20,19 +20,19 @@
--
-- 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
+--
+-- Requires 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
--- pg_catalog.LOWER(n.nspname) = pg_catalog.LOWER('public') AND
--- pg_catalog.LOWER(p.proname) = pg_catalog.LOWER('ST_AsGeoJson')
--- ORDER BY 1, 2, 3, 4;
-CREATE OR REPLACE FUNCTION _postgis_drop_function_if_needed(
+--
+-- SELECT pg_get_function_arguments('st_intersection(geometry,geometry,float8)'::regprocedure);
+--
+-- Or:
+--
+-- SELECT pg_get_function_arguments(oid) as args
+-- FROM pg_catalog.pg_proc
+-- WHERE proname = 'st_asgeojson'
+--
+CREATE OR REPLACE FUNCTION _postgis_drop_function_by_identity(
function_name text,
function_arguments text,
deprecated_in_version text DEFAULT 'xxx'
@@ -80,3 +80,39 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION _postgis_drop_function_by_signature(
+ function_signature text,
+ deprecated_in_version text DEFAULT 'xxx'
+) RETURNS void AS $$
+DECLARE
+ sql text;
+ detail TEXT;
+ newname TEXT;
+ proc RECORD;
+ deprecated_suffix TEXT := '_deprecated_by_postgis_' || deprecated_in_version;
+BEGIN
+
+ -- Check if the deprecated function exists
+ BEGIN
+
+ SELECT *
+ FROM pg_catalog.pg_proc
+ WHERE oid = function_signature::regprocedure
+ INTO proc;
+
+ EXCEPTION
+ WHEN undefined_function THEN
+ RAISE DEBUG 'Deprecated function % does not exist', function_signature;
+ RETURN;
+ END;
+
+ sql := pg_catalog.format(
+ 'ALTER FUNCTION %s RENAME TO %I',
+ proc.oid::regprocedure,
+ proc.proname || deprecated_suffix
+ );
+ EXECUTE sql;
+
+END;
+$$ LANGUAGE plpgsql;
diff --git a/postgis/postgis_before_upgrade.sql b/postgis/postgis_before_upgrade.sql
index f8607f216..0519d5559 100644
--- a/postgis/postgis_before_upgrade.sql
+++ b/postgis/postgis_before_upgrade.sql
@@ -22,7 +22,7 @@
-- 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
+SELECT _postgis_drop_function_by_identity
(
'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'
@@ -30,7 +30,7 @@ SELECT _postgis_drop_function_if_needed
-- FUNCTION ST_AsX3D was changed to add versioning for 2.0
-- (geom geometry, prec integer, options integer)
-SELECT _postgis_drop_function_if_needed
+SELECT _postgis_drop_function_by_identity
(
'ST_AsX3D',
'geom geometry, prec integer, options integer'
@@ -40,7 +40,7 @@ SELECT _postgis_drop_function_if_needed
-- 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
+SELECT _postgis_drop_function_by_identity
(
'UpdateGeometrySRID',
'catalogn_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer'
@@ -84,7 +84,7 @@ $$ ;
-- 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
+SELECT _postgis_drop_function_by_identity
(
'ST_AsLatLonText',
'geometry, text'
@@ -92,7 +92,7 @@ SELECT _postgis_drop_function_if_needed
-- 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
+SELECT _postgis_drop_function_by_identity
(
'ST_LineCrossingDirection',
'geom1 geometry, geom2 geometry'
@@ -100,7 +100,7 @@ SELECT _postgis_drop_function_if_needed
-- 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
+SELECT _postgis_drop_function_by_identity
(
'_ST_LineCrossingDirection',
'geom1 geometry, geom2 geometry'
@@ -108,7 +108,7 @@ SELECT _postgis_drop_function_if_needed
-- FUNCTION ST_AsGeoJson changed argument names
-- (pretty_print => pretty_bool) in 3.0alpha4
-SELECT _postgis_drop_function_if_needed
+SELECT _postgis_drop_function_by_identity
(
'ST_AsGeoJson',
$args$r record, geom_column text, maxdecimaldigits integer, pretty_print boolean$args$
@@ -116,7 +116,7 @@ SELECT _postgis_drop_function_if_needed
-- 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
+SELECT _postgis_drop_function_by_identity
(
'_st_orderingequals',
'GeometryA geometry, GeometryB geometry'
@@ -124,7 +124,7 @@ SELECT _postgis_drop_function_if_needed
-- 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
+SELECT _postgis_drop_function_by_identity
(
'st_orderingequals',
'GeometryA geometry, GeometryB geometry'
commit 49ddd911f69b7843bda7a8c06c44bf3de91f20b5
Author: Sandro Santilli <strk at kbt.io>
Date: Thu Aug 31 22:23:07 2023 +0200
Allow testing double-upgrades with upgrade-path
diff --git a/regress/run_test.pl b/regress/run_test.pl
index 0b502b6fe..a9cce2a56 100755
--- a/regress/run_test.pl
+++ b/regress/run_test.pl
@@ -184,7 +184,7 @@ sub postgis_restore
if ( $OPT_UPGRADE_PATH )
{
- $OPT_UPGRADE = 1; # implied
+ $OPT_UPGRADE = 1 if not $OPT_UPGRADE; # implied
my @path = split ('--', $OPT_UPGRADE_PATH);
$OPT_UPGRADE_FROM = $path[0]
|| die "Malformed upgrade path, <from>--<to> expected, $OPT_UPGRADE_PATH given";
-----------------------------------------------------------------------
Summary of changes:
postgis/common_after_upgrade.sql | 3 +-
postgis/common_before_upgrade.sql | 60 ++++++++++++++++++++++++++++++--------
postgis/postgis_before_upgrade.sql | 18 ++++++------
regress/run_test.pl | 2 +-
4 files changed, 60 insertions(+), 23 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list