Re: ALTER COLLATION misses errcode

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>
Subject: Re: ALTER COLLATION misses errcode
Date: 2026-10-31 08:56:05
Message-ID: e9376dd1-e2b7-4361-a130-7fa7b064b263@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30/10/2026 20:38, Kirill Reshke wrote:
> User running ALTER COLLATION receives an internal error:
>
> ALTER COLLATION "default" REFRESH VERSION;
> ERROR: cannot refresh version of default collation
> HINT: Use ALTER DATABASE ... REFRESH COLLATION VERSION instead.
>
> We do monitor our logs for XX00* error codes to check for data
> corruptions etc, so sql-reachable XX000 gives us a red alert.
>
> This simple one-liner should do:
>
> diff --git a/src/backend/commands/collationcmds.c
> b/src/backend/commands/collationcmds.c
> index cfa0e4610d9..1f6156f379b 100644
> --- a/src/backend/commands/collationcmds.c
> +++ b/src/backend/commands/collationcmds.c
> @@ -443,7 +443,8 @@ AlterCollation(AlterCollationStmt *stmt)
>
> if (collOid == DEFAULT_COLLATION_OID)
> ereport(ERROR,
> - (errmsg("cannot refresh version of default collation"),
> + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> + errmsg("cannot refresh version of default collation"),
> /* translator: %s is an SQL command */
> errhint("Use %s instead.",
> "ALTER DATABASE ... REFRESH COLLATION VERSION")));

Is ERRCODE_FEATURE_NOT_SUPPORTED correct here? Is this something that we
just don't currently support, but we potentially could, or is it
something that just doesn't make sense?

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2026-10-31 09:43:12 Re: Fix BRIN numeric_minmax_multi_ops out of range value range merging
Previous Message Heikki Linnakangas 2026-10-31 08:50:46 Re: [PATCH] Corruption Issue: Fix missing tts_tid in ExecForceStoreHeapTuple