diff options
Diffstat (limited to 'src/backend/utils/misc/guc.c')
-rw-r--r-- | src/backend/utils/misc/guc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index f12eef75e0c..dd5a46469a6 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -67,6 +67,12 @@ */ #define REALTYPE_PRECISION 17 +/* + * Safe search path when executing code as the table owner, such as during + * maintenance operations. + */ +#define GUC_SAFE_SEARCH_PATH "pg_catalog, pg_temp" + static int GUC_check_errcode_value; static List *reserved_class_prefix = NIL; @@ -2235,6 +2241,19 @@ NewGUCNestLevel(void) } /* + * Set search_path to a fixed value for maintenance operations. No effect + * during bootstrap, when the search_path is already set to a fixed value and + * cannot be changed. + */ +void +RestrictSearchPath(void) +{ + if (!IsBootstrapProcessingMode()) + set_config_option("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET, + PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false); +} + +/* * Do GUC processing at transaction or subtransaction commit or abort, or * when exiting a function that has proconfig settings, or when undoing a * transient assignment to some GUC variables. (The name is thus a bit of |