aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2024-03-04 17:31:38 -0800
committerJeff Davis <jdavis@postgresql.org>2024-03-04 17:31:38 -0800
commit2af07e2f749a9208ca1ed84fa1d8fe0e75833288 (patch)
tree94ba59cc859b1f22dbd0ee85b9062e757f50d65e /doc/src
parent2c29e7fc95b24f5ccfec0d2db458d2130606f446 (diff)
downloadpostgresql-2af07e2f749a9208ca1ed84fa1d8fe0e75833288.tar.gz
postgresql-2af07e2f749a9208ca1ed84fa1d8fe0e75833288.zip
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
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/amcheck.sgml3
-rw-r--r--doc/src/sgml/brin.sgml4
-rw-r--r--doc/src/sgml/ref/analyze.sgml6
-rw-r--r--doc/src/sgml/ref/cluster.sgml6
-rw-r--r--doc/src/sgml/ref/create_index.sgml6
-rw-r--r--doc/src/sgml/ref/refresh_materialized_view.sgml6
-rw-r--r--doc/src/sgml/ref/reindex.sgml6
-rw-r--r--doc/src/sgml/ref/vacuum.sgml6
8 files changed, 42 insertions, 1 deletions
diff --git a/doc/src/sgml/amcheck.sgml b/doc/src/sgml/amcheck.sgml
index 780fd05a73b..3af065615bc 100644
--- a/doc/src/sgml/amcheck.sgml
+++ b/doc/src/sgml/amcheck.sgml
@@ -24,6 +24,9 @@
to hold, we can expect binary searches on the affected page to
incorrectly guide index scans, resulting in wrong answers to SQL
queries. If the structure appears to be valid, no error is raised.
+ While these checking functions are run, the <xref
+ linkend="guc-search-path"/> is temporarily changed to <literal>pg_catalog,
+ pg_temp</literal>.
</para>
<para>
Verification is performed using the same procedures as those used by
diff --git a/doc/src/sgml/brin.sgml b/doc/src/sgml/brin.sgml
index 9c5ffcddf84..d898cc4720c 100644
--- a/doc/src/sgml/brin.sgml
+++ b/doc/src/sgml/brin.sgml
@@ -95,7 +95,9 @@
</para>
<para>
- Lastly, the following functions can be used:
+ Lastly, the following functions can be used (while these functions run,
+ <xref linkend="guc-search-path"/> is temporarily changed to
+ <literal>pg_catalog, pg_temp</literal>):
<simplelist>
<member>
<function>brin_summarize_new_values(regclass)</function>
diff --git a/doc/src/sgml/ref/analyze.sgml b/doc/src/sgml/ref/analyze.sgml
index 6ed8e7241b4..bad121a1f19 100644
--- a/doc/src/sgml/ref/analyze.sgml
+++ b/doc/src/sgml/ref/analyze.sgml
@@ -206,6 +206,12 @@ ANALYZE [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <r
</para>
<para>
+ While <command>ANALYZE</command> is running, the <xref
+ linkend="guc-search-path"/> is temporarily changed to <literal>pg_catalog,
+ pg_temp</literal>.
+ </para>
+
+ <para>
<command>ANALYZE</command>
requires only a read lock on the target table, so it can run in
parallel with other non-DDL activity on the table.
diff --git a/doc/src/sgml/ref/cluster.sgml b/doc/src/sgml/ref/cluster.sgml
index 557a94cea78..24340e7b9bf 100644
--- a/doc/src/sgml/ref/cluster.sgml
+++ b/doc/src/sgml/ref/cluster.sgml
@@ -154,6 +154,12 @@ CLUSTER [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <r
</para>
<para>
+ While <command>CLUSTER</command> is running, the <xref
+ linkend="guc-search-path"/> is temporarily changed to <literal>pg_catalog,
+ pg_temp</literal>.
+ </para>
+
+ <para>
When an index scan is used, a temporary copy of the table is created that
contains the table data in the index order. Temporary copies of each
index on the table are created as well. Therefore, you need free space on
diff --git a/doc/src/sgml/ref/create_index.sgml b/doc/src/sgml/ref/create_index.sgml
index 40986aa502f..621bc0e253c 100644
--- a/doc/src/sgml/ref/create_index.sgml
+++ b/doc/src/sgml/ref/create_index.sgml
@@ -790,6 +790,12 @@ Indexes:
</para>
<para>
+ While <command>CREATE INDEX</command> is running, the <xref
+ linkend="guc-search-path"/> is temporarily changed to <literal>pg_catalog,
+ pg_temp</literal>.
+ </para>
+
+ <para>
For most index methods, the speed of creating an index is
dependent on the setting of <xref linkend="guc-maintenance-work-mem"/>.
Larger values will reduce the time needed for index creation, so long
diff --git a/doc/src/sgml/ref/refresh_materialized_view.sgml b/doc/src/sgml/ref/refresh_materialized_view.sgml
index 7a019162c38..e4e5145058f 100644
--- a/doc/src/sgml/ref/refresh_materialized_view.sgml
+++ b/doc/src/sgml/ref/refresh_materialized_view.sgml
@@ -98,6 +98,12 @@ REFRESH MATERIALIZED VIEW [ CONCURRENTLY ] <replaceable class="parameter">name</
will be ordered that way; but <command>REFRESH MATERIALIZED
VIEW</command> does not guarantee to preserve that ordering.
</para>
+
+ <para>
+ While <command>REFRESH MATERIALIZED VIEW</command> is running, the <xref
+ linkend="guc-search-path"/> is temporarily changed to <literal>pg_catalog,
+ pg_temp</literal>.
+ </para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/reindex.sgml b/doc/src/sgml/ref/reindex.sgml
index 21e2e91d896..b214861742b 100644
--- a/doc/src/sgml/ref/reindex.sgml
+++ b/doc/src/sgml/ref/reindex.sgml
@@ -292,6 +292,12 @@ REINDEX [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] { DA
</para>
<para>
+ While <command>REINDEX</command> is running, the <xref
+ linkend="guc-search-path"/> is temporarily changed to <literal>pg_catalog,
+ pg_temp</literal>.
+ </para>
+
+ <para>
Reindexing a single index or table requires being the owner of that
index or table. Reindexing a schema or database requires being the
owner of that schema or database. Note specifically that it's thus
diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml
index a87c2e320e2..df0dd71a370 100644
--- a/doc/src/sgml/ref/vacuum.sgml
+++ b/doc/src/sgml/ref/vacuum.sgml
@@ -444,6 +444,12 @@ VACUUM [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <re
</para>
<para>
+ While <command>VACUUM</command> is running, the <xref
+ linkend="guc-search-path"/> is temporarily changed to <literal>pg_catalog,
+ pg_temp</literal>.
+ </para>
+
+ <para>
<command>VACUUM</command> cannot be executed inside a transaction block.
</para>