pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve error message for database object stats manipulation fun
Date: Tue, 19 Nov 2024 17:02:16 +0000
Message-ID: <E1tDRcG-002aOj-7m@gemulon.postgresql.org> (raw)

Improve error message for database object stats manipulation functions.

Previously, database object statistics manipulation functions like
pg_set_relation_stats() reported unclear error and hint messages
when executed during recovery. These messages were "internal",
making it difficult for users to understand the issue:

  ERROR:  cannot acquire lock mode ShareUpdateExclusiveLock on database objects while recovery is in progress
  HINT:  Only RowExclusiveLock or less can be acquired on database objects during recovery.

This commit updates the error handling so that, if these functions
are called during recovery, they produce clearer messages:

  ERROR:  recovery is in progress
  HINT:  Statistics cannot be modified during recovery.

The related documentation has also been updated to explicitly
clarify that these functions are not available during recovery.

Author: Fujii Masao
Reviewed-by: Heikki Linnakangas, Maxim Orlov
Discussion: https://postgr.es/m/6d313829-5f56-4a28-ae4b-bd01bf1ae791@oss.nttdata.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c166454496876818216e222890ab1ae788551c42

Modified Files
--------------
doc/src/sgml/func.sgml                   |  1 +
src/backend/statistics/attribute_stats.c | 12 ++++++++++++
src/backend/statistics/relation_stats.c  |  6 ++++++
3 files changed, 19 insertions(+)



Message-ID: <E1tDRcG-002aOj-7m@gemulon.postgresql.org>
Permalink:  ../E1tDRcG-002aOj-7m@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tDRcG-002aOj-7m@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-committers@postgresql.org
  Cc: fujii@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Improve error message for database object stats manipulation fun
  In-Reply-To: <E1tDRcG-002aOj-7m@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