| From: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | ALTER COLLATION misses errcode |
| Date: | 2026-10-30 18:38:13 |
| Message-ID: | CALdSSPhHy0HeptBdEhaetg+abhG_qjRgMb0BB38+7JezC4jnzA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello,
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")));
--
Best regards,
Kirill Reshke
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Prashant Chinnam | 2026-10-30 18:41:08 | Re: [PATCH] pgcrypto: Fix sha-crypt rounds= values that do not fit in int (BUG #19743) |
| Previous Message | shihao zhong | 2026-10-30 18:31:27 | Re: [PG19] Indexes from 18 miss rows after pg_upgrade |