Skip to content

Conversation

@japinli
Copy link
Contributor

@japinli japinli commented Jun 9, 2025

Corrects an issue where loading the pgtt extension, when pgtt isn't preloaded and pg_catalog is the last element in search_path, results in an "invalid value for parameter 'search_path'" error due to invalid list syntax.

For example:

DROP EXTENSION IF EXISTS pgtt;
\c - -
SET search_path TO pg_catalog;
CREATE EXTENSION pgtt;
SHOW search_path;

The above code snippet will cause the following error:

ERROR:  invalid value for parameter "search_path": "pg_catalog pgtt_schema, pg_catalog"
DETAIL:  List syntax is invalid.

After this fix, we might not need to compare the pg_catalog string, i.e.:

diff --git a/pgtt.c b/pgtt.c
index 6534e2a..0b08e03 100755
--- a/pgtt.c
+++ b/pgtt.c
@@ -1994,7 +1994,7 @@ force_pgtt_namespace(void)
         bool at_end = false;
         int len = strlen(old_search_path) - 10;
         char *p = strstr(old_search_path, "pg_catalog");
-        if (p != NULL && strcmp(p, "pg_catalog") == 0)
+        if (p != NULL)
         {
             /* remove redundant whitespaces */
             while (len > 0 && isspace(old_search_path[len - 1]))

I'm not sure this is valuable.

Corrects an issue where loading the pgtt extension, when pgtt isn't
preloaded and pg_catalog is the last element in search_path, results
in an "invalid value for parameter 'search_path'" error due to invalid
list syntax.
@darold darold merged commit c016d63 into darold:master Jun 9, 2025
6 checks passed
@japinli japinli deleted the invalid-search_path branch June 9, 2025 06:16
@darold
Copy link
Owner

darold commented Jun 9, 2025

Thanks @japinli for catching this case. I'm publishing a new release now.

@japinli
Copy link
Contributor Author

japinli commented Jun 9, 2025

Thanks @japinli for catching this case. I'm publishing a new release now.

@darold Thanks for merging this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants