Improve error messages for database object stats manipulation functions during recovery

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Improve error messages for database object stats manipulation functions during recovery
Date: 2024-10-25 17:07:44
Message-ID: 6d313829-5f56-4a28-ae4b-bd01bf1ae791@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

When database object stats manipulation functions like pg_set_relation_stats() are run,
they currently produce the following error and hint messages, which are "internal"
and make it hard 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.

So I'd like to propose updating these to clearer messages:

ERROR: recovery is in progress
HINT: Database object statistics manipulation functions cannot be executed during recovery.

Thought?

I've attached a patch implementing these changes. It also updates the documentation to
clearly state that these functions are not available during recovery.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachment Content-Type Size
v1-0001-Improve-error-message-for-database-object-stats-m.patch text/plain 3.7 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-10-25 17:35:00 Re: Alias of VALUES RTE in explain plan
Previous Message Bernd Helmle 2024-10-25 16:41:39 Re: [PATCH] Add sortsupport for range types and btree_gist