RE: ReplicationSlotRelease() crashes when the instance is in the single user mode

Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>

From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'Michael Paquier' <michael@paquier.xyz>
Cc: "'pgsql-hackers@lists.postgresql.org'" <pgsql-hackers@lists.postgresql.org>
Date: 2025-02-20T02:22:41Z
Lists: pgsql-hackers

Attachments

Dear Michael,

> I did not check how these call behave individually, just a few
> comments while putting my eyes on the patch.
> 
> +	if (!IsUnderPostmaster)
> +		elog(ERROR,
> +			 "slot operation is prohibited in the single user mode");
> 
> elog() should not be used for failures that can be user-facing as this
> would not provide any translation.

I intentionally used elog() because I thought single user mode is not user-facing.
But it is OK for me to use ereport() instead.

> I'd suggest rewording the error message to provide some more context,
> as well, say:
> "cannot use %s in single-user mode", "function_name"

Fixed. PSA new version

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Commits

  1. Fix assertion failure with replication slot release in single-user mode