pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <pgsql@j-davis.com>
To: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix search_path to a safe value during maintenance operations.
Date: Fri, 09 Jun 2023 17:37:57 -0700
Message-ID: <d20864b929ff769a0ebf772359719f05bb6982cd.camel@j-davis.com> (raw)
In-Reply-To: <89a415b86d5421941e4281ba5bf6288934078624.camel@j-davis.com>
References: <E1q7j7Y-000z1H-Hr@gemulon.postgresql.org>
	<89a415b86d5421941e4281ba5bf6288934078624.camel@j-davis.com>

On Fri, 2023-06-09 at 15:16 -0700, Jeff Davis wrote:
> On Fri, 2023-06-09 at 20:54 +0000, Jeff Davis wrote:
> > Fix search_path to a safe value during maintenance operations.
> 
> Looks like this is causing pg_amcheck failures in the buildfarm.
> Investigating...

It looks related to bt_index_check_internal(), which is called by SQL
functions bt_index_check() and bt_index_parent_check(). SQL functions
can be called in parallel, so it raises the error:

  ERROR:  cannot set parameters during a parallel operation

because commit 05e1737351 added the SetConfigOption() line. Normally
those functions would not be called in parallel, but
debug_parallel_mode makes that happen.

Attached a patch to mark those functions as PARALLEL UNSAFE, which
fixes the problem.

Alternatively, I could just take out that line, as those SQL functions
are not controlled by the MAINTAIN privilege. But for consistency I
think it's a good idea to leave it in so that index functions are
called with the right search path for amcheck.


-- 
Jeff Davis
PostgreSQL Contributor Team - AWS

Attachments:

v1-0001-amcheck-mark-bt_index_check-PARALLEL-UNSAFE.patch (text/x-patch, 2.4K) download From 0bc11bbc4b06228d33bd9fc6b29dcc9a25d81151 Mon Sep 17 00:00:00 2001 From: Jeff Davis <jeff@j-davis.com> Date: Fri, 9 Jun 2023 17:24:53 -0700 Subject: [PATCH v1] amcheck: mark bt_index_check() PARALLEL UNSAFE. These functions call bt_index_check_internal(), which needs to set the right search path before executing any index functions. Discussion: https://postgr.es/m/20230609232446.GA123624@nathanxps13 --- contrib/amcheck/Makefile | 4 +++- contrib/amcheck/amcheck--1.3--1.4.sql | 13 +++++++++++++ contrib/amcheck/amcheck.control | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 contrib/amcheck/amcheck--1.3--1.4.sql diff --git a/contrib/amcheck/Makefile b/contrib/amcheck/Makefile index b82f221e50..4896c586f8 100644 --- a/contrib/amcheck/Makefile +++ b/contrib/amcheck/Makefile @@ -7,7 +7,9 @@ OBJS = \ verify_nbtree.o EXTENSION = amcheck -DATA = amcheck--1.2--1.3.sql amcheck--1.1--1.2.sql amcheck--1.0--1.1.sql amcheck--1.0.sql +DATA = amcheck--1.3--1.4.sql amcheck--1.2--1.3.sql amcheck--1.1--1.2.sql \ + amcheck--1.0--1.1.sql amcheck--1.0.sql + PGFILEDESC = "amcheck - function for verifying relation integrity" REGRESS = check check_btree check_heap diff --git a/contrib/amcheck/amcheck--1.3--1.4.sql b/contrib/amcheck/amcheck--1.3--1.4.sql new file mode 100644 index 0000000000..409cd55195 --- /dev/null +++ b/contrib/amcheck/amcheck--1.3--1.4.sql @@ -0,0 +1,13 @@ +/* contrib/amcheck/amcheck--1.3--1.4.sql */ + +-- complain if script is sourced in psql, rather than via CREATE EXTENSION +\echo Use "ALTER EXTENSION amcheck UPDATE TO '1.4'" to load this file. \quit + +-- +-- Mark bt_index_check functions as PARALLEL UNSAFE. +-- +ALTER FUNCTION bt_index_check(regclass) PARALLEL UNSAFE; +ALTER FUNCTION bt_index_check(regclass, boolean) PARALLEL UNSAFE; +ALTER FUNCTION bt_index_parent_check(regclass) PARALLEL UNSAFE; +ALTER FUNCTION bt_index_parent_check(regclass, boolean) PARALLEL UNSAFE; +ALTER FUNCTION bt_index_parent_check(regclass, boolean, boolean) PARALLEL UNSAFE; diff --git a/contrib/amcheck/amcheck.control b/contrib/amcheck/amcheck.control index ab50931f75..e67ace01c9 100644 --- a/contrib/amcheck/amcheck.control +++ b/contrib/amcheck/amcheck.control @@ -1,5 +1,5 @@ # amcheck extension comment = 'functions for verifying relation integrity' -default_version = '1.3' +default_version = '1.4' module_pathname = '$libdir/amcheck' relocatable = true -- 2.34.1

view thread (59+ messages)  latest in thread

Message-ID: <d20864b929ff769a0ebf772359719f05bb6982cd.camel@j-davis.com>
Permalink:  ../d20864b929ff769a0ebf772359719f05bb6982cd.camel@j-davis.com/
Also on:    postgresql.org/message-id/d20864b929ff769a0ebf772359719f05bb6982cd.camel@j-davis.com

 ·  · 

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-committers@postgresql.org
  Cc: pgsql@j-davis.com, jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix search_path to a safe value during maintenance operations.
  In-Reply-To: <d20864b929ff769a0ebf772359719f05bb6982cd.camel@j-davis.com>

* 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