[postgis-tickets] [SCM] PostGIS branch stable-3.3 updated. 3.3.4-6-ga514af682
git at osgeo.org
git at osgeo.org
Sat Aug 5 14:58:21 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, stable-3.3 has been updated
via a514af682b38c7b329ec50dd7ffa15d3e3bcbacd (commit)
from e06d678ee856912a7627a23d8e92a7bc0ae745dc (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 a514af682b38c7b329ec50dd7ffa15d3e3bcbacd
Author: Jelte Fennema <github-tech at jeltef.nl>
Date: Fri Jul 14 12:37:52 2023 +0200
Fix add to search_path (Jelte Fennema)
Closes #5442 for PostGIS 3.3.5
Closes https://git.osgeo.org/gitea/postgis/postgis/pulls/134
diff --git a/NEWS b/NEWS
index 3e0ef6110..57ded465a 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,9 @@ PostGIS 3.3.5dev
YYYY/MM/DD
* Bug Fixes and Enhancements *
- - ...
+ - #5442, [postgis_tiger_geocoder,postgis_topology]
+ Database search_path does not do
+ what it intends to do (Jelte Fennema)
PostGIS 3.3.4
2023/07/28
diff --git a/doc/introduction.xml b/doc/introduction.xml
index 1ed7fa4f2..8d1407ad0 100644
--- a/doc/introduction.xml
+++ b/doc/introduction.xml
@@ -262,6 +262,7 @@
<member>Jan Katins</member>
<member>Jason Smith</member>
<member>Jeff Adams</member>
+ <member>Jelte Fennema</member>
<member>Jim Jones</member>
<member>Joe Conway</member>
<member>Jonne Savolainen</member>
diff --git a/extensions/postgis_extension_helper.sql b/extensions/postgis_extension_helper.sql
index 5fa7bde72..a984ecb92 100644
--- a/extensions/postgis_extension_helper.sql
+++ b/extensions/postgis_extension_helper.sql
@@ -126,7 +126,16 @@ BEGIN
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
+ SELECT setting
+ INTO var_cur_search_path
+ FROM pg_catalog.pg_file_settings
+ WHERE name OPERATOR(pg_catalog.=) 'search_path' AND applied;
+
+ RAISE NOTICE 'cur_search_path from pg_file_settings is %', var_cur_search_path;
+ END IF;
+
+ IF var_cur_search_path IS NULL THEN
+ SELECT boot_val
INTO var_cur_search_path
FROM pg_catalog.pg_settings
WHERE name OPERATOR(pg_catalog.=) 'search_path';
@@ -134,7 +143,6 @@ BEGIN
RAISE NOTICE 'cur_search_path from pg_settings is %', var_cur_search_path;
END IF;
-
IF var_cur_search_path LIKE '%' OPERATOR(pg_catalog.||) pg_catalog.quote_ident(a_schema_name) OPERATOR(pg_catalog.||) '%' THEN
var_result := a_schema_name OPERATOR(pg_catalog.||) ' already in database search_path';
ELSE
diff --git a/topology/sql/manage/ManageHelper.sql.in b/topology/sql/manage/ManageHelper.sql.in
index 2acfd9c41..eb9da2d02 100644
--- a/topology/sql/manage/ManageHelper.sql.in
+++ b/topology/sql/manage/ManageHelper.sql.in
@@ -25,18 +25,50 @@ DECLARE
var_result text;
var_cur_search_path text;
BEGIN
- SELECT reset_val INTO var_cur_search_path FROM pg_catalog.pg_settings WHERE name = 'search_path';
- IF var_cur_search_path LIKE '%' || pg_catalog.quote_ident(a_schema_name) || '%' THEN
- var_result := a_schema_name || ' already in database search_path';
+ WITH settings AS (
+ SELECT pg_catalog.unnest(setconfig) config
+ FROM pg_catalog.pg_db_role_setting
+ WHERE setdatabase OPERATOR(pg_catalog.=) (
+ SELECT oid
+ FROM pg_catalog.pg_database
+ WHERE datname OPERATOR(pg_catalog.=) pg_catalog.current_database()
+ ) and setrole OPERATOR(pg_catalog.=) 0
+ )
+ SELECT pg_catalog.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 setting
+ INTO var_cur_search_path
+ FROM pg_catalog.pg_file_settings
+ WHERE name OPERATOR(pg_catalog.=) 'search_path' AND applied;
+
+ RAISE NOTICE 'cur_search_path from pg_file_settings is %', var_cur_search_path;
+ END IF;
+
+ IF var_cur_search_path IS NULL THEN
+ SELECT boot_val
+ INTO var_cur_search_path
+ FROM pg_catalog.pg_settings
+ WHERE name OPERATOR(pg_catalog.=) 'search_path';
+
+ RAISE NOTICE 'cur_search_path from pg_settings is %', var_cur_search_path;
+ END IF;
+
+ IF var_cur_search_path LIKE '%' OPERATOR(pg_catalog.||) pg_catalog.quote_ident(a_schema_name) OPERATOR(pg_catalog.||) '%' THEN
+ var_result := a_schema_name OPERATOR(pg_catalog.||) ' already in database search_path';
ELSE
- var_cur_search_path := var_cur_search_path || ', '
- || 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 ';
+ var_cur_search_path := var_cur_search_path OPERATOR(pg_catalog.||) ', '
+ OPERATOR(pg_catalog.||) pg_catalog.quote_ident(a_schema_name);
+ EXECUTE 'ALTER DATABASE ' OPERATOR(pg_catalog.||) pg_catalog.quote_ident(pg_catalog.current_database())
+ OPERATOR(pg_catalog.||) ' SET search_path = ' OPERATOR(pg_catalog.||) var_cur_search_path;
+ var_result := a_schema_name OPERATOR(pg_catalog.||) ' has been added to end of database search_path ';
END IF;
- EXECUTE 'SET search_path = ' || var_cur_search_path;
+ EXECUTE 'SET search_path = ' OPERATOR(pg_catalog.||) var_cur_search_path;
RETURN var_result;
END
-----------------------------------------------------------------------
Summary of changes:
NEWS | 4 ++-
doc/introduction.xml | 1 +
extensions/postgis_extension_helper.sql | 12 ++++++--
topology/sql/manage/ManageHelper.sql.in | 50 +++++++++++++++++++++++++++------
4 files changed, 55 insertions(+), 12 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list