Skip to content

Commit 2fcc7ee

Browse files
committed
Revert "Fix search_path to a safe value during maintenance operations."
This reverts commit 05e1737.
1 parent a1cd982 commit 2fcc7ee

File tree

15 files changed

+16
-48
lines changed

15 files changed

+16
-48
lines changed

contrib/amcheck/verify_nbtree.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed,
282282
SetUserIdAndSecContext(heaprel->rd_rel->relowner,
283283
save_sec_context | SECURITY_RESTRICTED_OPERATION);
284284
save_nestlevel = NewGUCNestLevel();
285-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
286-
PGC_S_SESSION);
287285
}
288286
else
289287
{

src/backend/access/brin/brin.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,8 +1066,6 @@ brin_summarize_range(PG_FUNCTION_ARGS)
10661066
SetUserIdAndSecContext(heapRel->rd_rel->relowner,
10671067
save_sec_context | SECURITY_RESTRICTED_OPERATION);
10681068
save_nestlevel = NewGUCNestLevel();
1069-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
1070-
PGC_S_SESSION);
10711069
}
10721070
else
10731071
{

src/backend/catalog/index.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,8 +1475,6 @@ index_concurrently_build(Oid heapRelationId,
14751475
SetUserIdAndSecContext(heapRel->rd_rel->relowner,
14761476
save_sec_context | SECURITY_RESTRICTED_OPERATION);
14771477
save_nestlevel = NewGUCNestLevel();
1478-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
1479-
PGC_S_SESSION);
14801478

14811479
indexRelation = index_open(indexRelationId, RowExclusiveLock);
14821480

@@ -3008,8 +3006,6 @@ index_build(Relation heapRelation,
30083006
SetUserIdAndSecContext(heapRelation->rd_rel->relowner,
30093007
save_sec_context | SECURITY_RESTRICTED_OPERATION);
30103008
save_nestlevel = NewGUCNestLevel();
3011-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
3012-
PGC_S_SESSION);
30133009

30143010
/* Set up initial progress report status */
30153011
{
@@ -3345,8 +3341,6 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot)
33453341
SetUserIdAndSecContext(heapRelation->rd_rel->relowner,
33463342
save_sec_context | SECURITY_RESTRICTED_OPERATION);
33473343
save_nestlevel = NewGUCNestLevel();
3348-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
3349-
PGC_S_SESSION);
33503344

33513345
indexRelation = index_open(indexId, RowExclusiveLock);
33523346

@@ -3607,8 +3601,6 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
36073601
SetUserIdAndSecContext(heapRelation->rd_rel->relowner,
36083602
save_sec_context | SECURITY_RESTRICTED_OPERATION);
36093603
save_nestlevel = NewGUCNestLevel();
3610-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
3611-
PGC_S_SESSION);
36123604

36133605
if (progress)
36143606
{

src/backend/commands/analyze.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,6 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
348348
SetUserIdAndSecContext(onerel->rd_rel->relowner,
349349
save_sec_context | SECURITY_RESTRICTED_OPERATION);
350350
save_nestlevel = NewGUCNestLevel();
351-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
352-
PGC_S_SESSION);
353351

354352
/* measure elapsed time iff autovacuum logging requires it */
355353
if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0)

src/backend/commands/cluster.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,6 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params)
355355
SetUserIdAndSecContext(OldHeap->rd_rel->relowner,
356356
save_sec_context | SECURITY_RESTRICTED_OPERATION);
357357
save_nestlevel = NewGUCNestLevel();
358-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
359-
PGC_S_SESSION);
360358

361359
/*
362360
* Since we may open a new transaction for each relation, we have to check

src/backend/commands/indexcmds.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,6 @@ DefineIndex(Oid relationId,
575575
int root_save_nestlevel;
576576

577577
root_save_nestlevel = NewGUCNestLevel();
578-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
579-
PGC_S_SESSION);
580578

581579
/*
582580
* Some callers need us to run with an empty default_tablespace; this is a
@@ -1302,8 +1300,6 @@ DefineIndex(Oid relationId,
13021300
SetUserIdAndSecContext(childrel->rd_rel->relowner,
13031301
child_save_sec_context | SECURITY_RESTRICTED_OPERATION);
13041302
child_save_nestlevel = NewGUCNestLevel();
1305-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
1306-
PGC_S_SESSION);
13071303

13081304
/*
13091305
* Don't try to create indexes on foreign tables, though. Skip
@@ -3757,8 +3753,6 @@ ReindexRelationConcurrently(Oid relationOid, ReindexParams *params)
37573753
SetUserIdAndSecContext(heapRel->rd_rel->relowner,
37583754
save_sec_context | SECURITY_RESTRICTED_OPERATION);
37593755
save_nestlevel = NewGUCNestLevel();
3760-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
3761-
PGC_S_SESSION);
37623756

37633757
/* determine safety of this index for set_indexsafe_procflags */
37643758
idx->safe = (indexRel->rd_indexprs == NIL &&

src/backend/commands/matview.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,6 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
179179
SetUserIdAndSecContext(relowner,
180180
save_sec_context | SECURITY_RESTRICTED_OPERATION);
181181
save_nestlevel = NewGUCNestLevel();
182-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
183-
PGC_S_SESSION);
184182

185183
/* Make sure it is a materialized view. */
186184
if (matviewRel->rd_rel->relkind != RELKIND_MATVIEW)

src/backend/commands/vacuum.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,8 +2172,6 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams *params,
21722172
SetUserIdAndSecContext(rel->rd_rel->relowner,
21732173
save_sec_context | SECURITY_RESTRICTED_OPERATION);
21742174
save_nestlevel = NewGUCNestLevel();
2175-
SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET,
2176-
PGC_S_SESSION);
21772175

21782176
/*
21792177
* If PROCESS_MAIN is set (the default), it's time to vacuum the main

src/bin/scripts/t/100_vacuumdb.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,15 @@
109109
CREATE FUNCTION f1(int) RETURNS int LANGUAGE SQL AS 'SELECT f0($1)';
110110
CREATE TABLE funcidx (x int);
111111
INSERT INTO funcidx VALUES (0),(1),(2),(3);
112+
CREATE INDEX i0 ON funcidx ((f1(x)));
112113
CREATE SCHEMA "Foo";
113114
CREATE TABLE "Foo".bar(id int);
114115
|);
115116
$node->command_ok([qw|vacuumdb -Z --table="need""q(uot"(")x") postgres|],
116117
'column list');
118+
$node->command_fails(
119+
[qw|vacuumdb -Zt funcidx postgres|],
120+
'unqualified name via functional index');
117121

118122
$node->command_fails(
119123
[ 'vacuumdb', '--analyze', '--table', 'vactable(c)', 'postgres' ],

src/include/utils/guc.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,6 @@ typedef enum
201201

202202
#define GUC_QUALIFIER_SEPARATOR '.'
203203

204-
/*
205-
* Safe search path when executing code as the table owner, such as during
206-
* maintenance operations.
207-
*/
208-
#define GUC_SAFE_SEARCH_PATH "pg_catalog, pg_temp"
209-
210204
/*
211205
* Bit values in "flags" of a GUC variable. Note that these don't appear
212206
* on disk, so we can reassign their values freely.

0 commit comments

Comments
 (0)