pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix search_path to a safe value during maintenance operations.
Date: Tue, 05 Mar 2024 01:42:46 +0000
Message-ID: <E1rhJpO-0027Wf-9L@gemulon.postgresql.org> (raw)

Fix search_path to a safe value during maintenance operations.

While executing maintenance operations (ANALYZE, CLUSTER, REFRESH
MATERIALIZED VIEW, REINDEX, or VACUUM), set search_path to
'pg_catalog, pg_temp' to prevent inconsistent behavior.

Functions that are used for functional indexes, in index expressions,
or in materialized views and depend on a different search path must be
declared with CREATE FUNCTION ... SET search_path='...'.

This change was previously committed as 05e1737351, then reverted in
commit 2fcc7ee7af because it was too late in the cycle.

Preparation for the MAINTAIN privilege, which was previously reverted
due to search_path manipulation hazards.

Discussion: https://postgr.es/m/d4ccaf3658cb3c281ec88c851a09733cd9482f22.camel@j-davis.com
Discussion: https://postgr.es/m/E1q7j7Y-000z1H-Hr%40gemulon.postgresql.org
Discussion: https://postgr.es/m/e44327179e5c9015c8dda67351c04da552066017.camel%40j-davis.com
Reviewed-by: Greg Stark, Nathan Bossart, Noah Misch

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2af07e2f749a9208ca1ed84fa1d8fe0e75833288

Modified Files
--------------
contrib/amcheck/t/004_verify_nbtree_unique.pl      | 33 +++++++++-------
contrib/amcheck/verify_nbtree.c                    |  2 +
doc/src/sgml/amcheck.sgml                          |  3 ++
doc/src/sgml/brin.sgml                             |  4 +-
doc/src/sgml/ref/analyze.sgml                      |  6 +++
doc/src/sgml/ref/cluster.sgml                      |  6 +++
doc/src/sgml/ref/create_index.sgml                 |  6 +++
doc/src/sgml/ref/refresh_materialized_view.sgml    |  6 +++
doc/src/sgml/ref/reindex.sgml                      |  6 +++
doc/src/sgml/ref/vacuum.sgml                       |  6 +++
src/backend/access/brin/brin.c                     |  2 +
src/backend/catalog/index.c                        |  9 +++++
src/backend/catalog/namespace.c                    |  3 ++
src/backend/commands/analyze.c                     |  2 +
src/backend/commands/cluster.c                     |  2 +
src/backend/commands/indexcmds.c                   |  8 ++++
src/backend/commands/matview.c                     |  2 +
src/backend/commands/vacuum.c                      |  2 +
src/bin/scripts/t/100_vacuumdb.pl                  |  4 --
src/include/utils/guc.h                            |  6 +++
.../test_oat_hooks/expected/alter_table.out        |  2 +
.../test_oat_hooks/expected/test_oat_hooks.out     |  4 ++
src/test/regress/expected/matview.out              |  4 +-
src/test/regress/expected/namespace.out            | 44 ++++++++++++++++++++++
src/test/regress/expected/privileges.out           | 12 +++---
src/test/regress/expected/vacuum.out               |  2 +-
src/test/regress/sql/matview.sql                   |  4 +-
src/test/regress/sql/namespace.sql                 | 32 ++++++++++++++++
src/test/regress/sql/privileges.sql                |  8 ++--
src/test/regress/sql/vacuum.sql                    |  2 +-
30 files changed, 200 insertions(+), 32 deletions(-)



view thread (59+ messages)  latest in thread

Message-ID: <E1rhJpO-0027Wf-9L@gemulon.postgresql.org>
Permalink:  ../E1rhJpO-0027Wf-9L@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rhJpO-0027Wf-9L@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix search_path to a safe value during maintenance operations.
  In-Reply-To: <E1rhJpO-0027Wf-9L@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox