On 2026-May-14, Ante Krešić wrote:
> + if (!conForm->convalidated)
> + ereport(ERROR,
> +
> errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> + errmsg("index \"%s\" cannot be
> used as replica identity because column \"%s\" has an invalid not-null
> constraint",
> +
> RelationGetRelationName(indexRel),
> +
> NameStr(attr->attname)),
> + /*- translator: second %s is a constraint
> characteristic such as NOT VALID */
> + errdetail("The constraint
> \"%s\" is marked %s.",
> +
> NameStr(conForm->conname), "NOT VALID"),
> + errhint("You might need to
> validate it using %s.",
> + "ALTER TABLE
> ... VALIDATE CONSTRAINT"));
I'd rather make this error be
+ ereport(ERROR,
+ errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("cannot use index \"%s\" as replica identity",
+ RelationGetRelationName(indexRel),
+ NameStr(attr->attname)),
+ /*- translator: third %s is a constraint characteristic
such as NOT VALID */
+ errdetail("The constraint \"%s\" on column \"%s\" is marked
%s.",
+ NameStr(conForm->conname),
NameStr(attr->attname), "NOT VALID"),
+ errhint("You might need to validate it using %s.",
+ "ALTER TABLE ... VALIDATE CONSTRAINT"));
The other ones which you're mimicking are IMO in poor style.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
Officer Krupke, what are we to do?
Gee, officer Krupke, Krup you! (West Side Story, "Gee, Officer Krupke")