[postgis-tickets] [SCM] PostGIS branch stable-3.2 updated. 3.2.1-18-gf2d66fac9
git at osgeo.org
git at osgeo.org
Thu May 19 19:24:41 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 f2d66fac95641e6e4dcef11f099209a025d0e5e3 (commit)
via 4df095200b4bd0e85b0c61188a80b2fee2e18b2a (commit)
from a515156810889c58c4fb50ad0958e8dcd3ccf084 (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 f2d66fac95641e6e4dcef11f099209a025d0e5e3
Merge: 4df095200 a51515681
Author: Regina Obe <lr at pcorp.us>
Date: Thu May 19 22:24:35 2022 -0400
Merge branch 'stable-3.2' of git.osgeo.org:postgis/postgis into stable-3.2
commit 4df095200b4bd0e85b0c61188a80b2fee2e18b2a
Author: Regina Obe <lr at pcorp.us>
Date: Thu May 19 22:20:16 2022 -0400
Change signature of AddToSearchPath, reference #5150 for PostGIS 3.2.2
Fix search path function, references #5125 for PostGIS 3.2.2
diff --git a/NEWS b/NEWS
index db8de5ab9..44d335f65 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ PostGIS 3.2.2dev
- #5100, Don't use pg_atoi (removed in PG15) (Laurenz Albe)
- #5123, Support for PG15 (JSON funcs exposed) (Regina Obe)
- #5151, ST_SetPoint with empty geometries (Regina Obe)
+ - #5150, Change signature of AddToSearchPath (Regina Obe)
+ - #5125, Fix search path function (Sandro Santilli)
PostGIS 3.2.1
2022/02/12
diff --git a/extensions/postgis_extension_helper.sql b/extensions/postgis_extension_helper.sql
index bc1e9f92d..4d9b19538 100644
--- a/extensions/postgis_extension_helper.sql
+++ b/extensions/postgis_extension_helper.sql
@@ -18,7 +18,7 @@
-- this is needed because there is no ALTER EXTENSION DROP FUNCTION/AGGREGATE command
-- and we can't CREATE OR REPALCe functions whose signatures have changed and we can drop them if they are part of an extention
-- So we use this to remove it from extension first before we drop
-CREATE OR REPLACE FUNCTION postgis_extension_remove_objects(param_extension text, param_type text)
+CREATE FUNCTION postgis_extension_remove_objects(param_extension text, param_type text)
RETURNS boolean AS
$$
DECLARE
@@ -30,38 +30,38 @@ DECLARE
var_sql_list text := '';
var_pgsql_version integer := current_setting('server_version_num');
BEGIN
- var_class := CASE WHEN lower(param_type) = 'function' OR lower(param_type) = 'aggregate' THEN 'pg_proc' ELSE '' END;
- var_is_aggregate := CASE WHEN lower(param_type) = 'aggregate' THEN true ELSE false END;
+ var_class := CASE WHEN pg_catalog.lower(param_type) = 'function' OR pg_catalog.lower(param_type) = 'aggregate' THEN 'pg_catalog.pg_proc' ELSE '' END;
+ var_is_aggregate := CASE WHEN pg_catalog.lower(param_type) = 'aggregate' THEN true ELSE false END;
IF var_pgsql_version < 110000 THEN
var_sql_list := $sql$SELECT 'ALTER EXTENSION ' || e.extname || ' DROP ' || $3 || ' ' || COALESCE(proc.proname || '(' || oidvectortypes(proc.proargtypes) || ')' ,typ.typname, cd.relname, op.oprname,
cs.typname || ' AS ' || ct.typname || ') ', opcname, opfname) || ';' AS remove_command
- FROM pg_depend As d INNER JOIN pg_extension As e
- ON d.refobjid = e.oid INNER JOIN pg_class As c ON
+ FROM pg_catalog.pg_depend As d INNER JOIN pg_catalog.pg_extension As e
+ ON d.refobjid = e.oid INNER JOIN pg_catalog.pg_class As c ON
c.oid = d.classid
- LEFT JOIN pg_proc AS proc ON proc.oid = d.objid
- LEFT JOIN pg_type AS typ ON typ.oid = d.objid
- LEFT JOIN pg_class As cd ON cd.oid = d.objid
+ LEFT JOIN pg_catalog.pg_proc AS proc ON proc.oid = d.objid
+ LEFT JOIN pg_catalog.pg_type AS typ ON typ.oid = d.objid
+ LEFT JOIN pg_catalog.pg_class As cd ON cd.oid = d.objid
LEFT JOIN pg_operator As op ON op.oid = d.objid
- LEFT JOIN pg_cast AS ca ON ca.oid = d.objid
- LEFT JOIN pg_type AS cs ON ca.castsource = cs.oid
- LEFT JOIN pg_type AS ct ON ca.casttarget = ct.oid
+ LEFT JOIN pg_catalog.pg_cast AS ca ON ca.oid = d.objid
+ LEFT JOIN pg_catalog.pg_type AS cs ON ca.castsource = cs.oid
+ LEFT JOIN pg_catalog.pg_type AS ct ON ca.casttarget = ct.oid
LEFT JOIN pg_opclass As oc ON oc.oid = d.objid
LEFT JOIN pg_opfamily As ofa ON ofa.oid = d.objid
WHERE d.deptype = 'e' and e.extname = $1 and c.relname = $2 AND COALESCE(proc.proisagg, false) = $4;$sql$;
ELSE -- for PostgreSQL 11 and above, they removed proc.proisagg among others and replaced with some func type thing
var_sql_list := $sql$SELECT 'ALTER EXTENSION ' || e.extname || ' DROP ' || $3 || ' ' || COALESCE(proc.proname || '(' || oidvectortypes(proc.proargtypes) || ')' ,typ.typname, cd.relname, op.oprname,
cs.typname || ' AS ' || ct.typname || ') ', opcname, opfname) || ';' AS remove_command
- FROM pg_depend As d INNER JOIN pg_extension As e
- ON d.refobjid = e.oid INNER JOIN pg_class As c ON
+ FROM pg_catalog.pg_depend As d INNER JOIN pg_catalog.pg_extension As e
+ ON d.refobjid = e.oid INNER JOIN pg_catalog.pg_class As c ON
c.oid = d.classid
- LEFT JOIN pg_proc AS proc ON proc.oid = d.objid
- LEFT JOIN pg_type AS typ ON typ.oid = d.objid
- LEFT JOIN pg_class As cd ON cd.oid = d.objid
+ LEFT JOIN pg_catalog.pg_proc AS proc ON proc.oid = d.objid
+ LEFT JOIN pg_catalog.pg_type AS typ ON typ.oid = d.objid
+ LEFT JOIN pg_catalog.pg_class As cd ON cd.oid = d.objid
LEFT JOIN pg_operator As op ON op.oid = d.objid
- LEFT JOIN pg_cast AS ca ON ca.oid = d.objid
- LEFT JOIN pg_type AS cs ON ca.castsource = cs.oid
- LEFT JOIN pg_type AS ct ON ca.casttarget = ct.oid
+ LEFT JOIN pg_catalog.pg_cast AS ca ON ca.oid = d.objid
+ LEFT JOIN pg_catalog.pg_type AS cs ON ca.castsource = cs.oid
+ LEFT JOIN pg_catalog.pg_type AS ct ON ca.casttarget = ct.oid
LEFT JOIN pg_opclass As oc ON oc.oid = d.objid
LEFT JOIN pg_opfamily As ofa ON ofa.oid = d.objid
WHERE d.deptype = 'e' and e.extname = $1 and c.relname = $2 AND (proc.prokind = 'a') = $4;$sql$;
@@ -81,11 +81,11 @@ END;
$$
LANGUAGE plpgsql VOLATILE;
-CREATE OR REPLACE FUNCTION postgis_extension_drop_if_exists(param_extension text, param_statement text)
+CREATE FUNCTION postgis_extension_drop_if_exists(param_extension text, param_statement text)
RETURNS boolean AS
$$
DECLARE
- var_sql_ext text := 'ALTER EXTENSION ' || quote_ident(param_extension) || ' ' || replace(param_statement, 'IF EXISTS', '');
+ var_sql_ext text := 'ALTER EXTENSION ' || pg_catalog.quote_ident(param_extension) || ' ' || replace(param_statement, 'IF EXISTS', '');
var_result boolean := false;
BEGIN
BEGIN
@@ -101,7 +101,7 @@ END;
$$
LANGUAGE plpgsql VOLATILE;
-CREATE OR REPLACE FUNCTION postgis_extension_AddToSearchPath(a_schema_name varchar)
+CREATE FUNCTION postgis_extension_AddToSearchPath(a_schema_name text)
RETURNS text
AS
$$
@@ -109,13 +109,38 @@ DECLARE
var_result text;
var_cur_search_path text;
BEGIN
- SELECT reset_val INTO var_cur_search_path FROM pg_settings WHERE name = 'search_path';
- IF var_cur_search_path LIKE '%' || quote_ident(a_schema_name) || '%' THEN
+
+ WITH settings AS (
+ SELECT unnest(setconfig) config
+ FROM pg_catalog.pg_db_role_setting
+ WHERE setdatabase = (
+ SELECT oid
+ FROM pg_catalog.pg_database
+ WHERE datname = current_database()
+ ) and setrole = 0
+ )
+ SELECT regexp_replace(config, '^search_path=', '')
+ FROM settings WHERE config like 'search_path=%'
+ INTO var_cur_search_path;
+
+ RAISE NOTICE 'cur_search_path from pg_db_role_setting is %', var_cur_search_path;
+
+ IF var_cur_search_path IS NULL THEN
+ SELECT reset_val
+ INTO var_cur_search_path
+ FROM pg_catalog.pg_settings
+ WHERE name = 'search_path';
+
+ RAISE NOTICE 'cur_search_path from pg_settings is %', var_cur_search_path;
+ END IF;
+
+
+ IF var_cur_search_path LIKE '%' || pg_catalog.quote_ident(a_schema_name) || '%' THEN
var_result := a_schema_name || ' already in database search_path';
ELSE
var_cur_search_path := var_cur_search_path || ', '
- || quote_ident(a_schema_name);
- EXECUTE 'ALTER DATABASE ' || quote_ident(current_database())
+ || pg_catalog.quote_ident(a_schema_name);
+ EXECUTE 'ALTER DATABASE ' || pg_catalog.quote_ident(pg_catalog.current_database())
|| ' SET search_path = ' || var_cur_search_path;
var_result := a_schema_name || ' has been added to end of database search_path ';
END IF;
diff --git a/extensions/postgis_extension_helper_uninstall.sql b/extensions/postgis_extension_helper_uninstall.sql
index b08048fd9..2fb1d1756 100644
--- a/extensions/postgis_extension_helper_uninstall.sql
+++ b/extensions/postgis_extension_helper_uninstall.sql
@@ -15,4 +15,5 @@
-- and should be called at the end of the extension upgrade file
DROP FUNCTION postgis_extension_remove_objects(text, text);
DROP FUNCTION postgis_extension_drop_if_exists(text, text);
-DROP FUNCTION postgis_extension_AddToSearchPath(varchar);
+DROP FUNCTION IF EXISTS postgis_extension_AddToSearchPath(varchar);
+DROP FUNCTION IF EXISTS postgis_extension_AddToSearchPath(text);
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list