0001-Adjust-the-error-message-to-reflect-the-inheritance-.patch
application/octet-stream
Filename: 0001-Adjust-the-error-message-to-reflect-the-inheritance-.patch
Type: application/octet-stream
Part: 0
From 25f39d35961edcad75a0f3ca6b7eb57314b08e68 Mon Sep 17 00:00:00 2001
From: Tender Wang <tndrwang@gmail.com>
Date: Sat, 9 May 2026 10:20:51 +0800
Subject: [PATCH] Adjust the error message to reflect the inheritance
relationship.
---
src/backend/commands/tablecmds.c | 2 +-
src/test/regress/expected/indexing.out | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 88451c91448..a23d4de8ed6 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -9652,7 +9652,7 @@ ATPrepAddPrimaryKey(List **wqueue, Relation rel, AlterTableCmd *cmd,
tup = findNotNullConstraint(childrelid, strVal(column));
if (!tup)
ereport(ERROR,
- errmsg("column \"%s\" of table \"%s\" is not marked NOT NULL",
+ errmsg("column \"%s\" in child table \"%s\" is not marked NOT NULL",
strVal(column), get_rel_name(childrelid)));
/* verify it's good enough */
verifyNotNullPKCompatible(tup, strVal(column));
diff --git a/src/test/regress/expected/indexing.out b/src/test/regress/expected/indexing.out
index 929feda6fa3..ac3107da5ab 100644
--- a/src/test/regress/expected/indexing.out
+++ b/src/test/regress/expected/indexing.out
@@ -1382,7 +1382,7 @@ create table idxpart0 (like idxpart);
alter table idxpart0 add unique (a);
alter table idxpart attach partition idxpart0 default;
alter table only idxpart add primary key (a); -- fail, no not-null constraint
-ERROR: column "a" of table "idxpart0" is not marked NOT NULL
+ERROR: column "a" in child table "idxpart0" is not marked NOT NULL
alter table idxpart0 alter column a set not null;
alter table only idxpart add primary key (a); -- now it works
alter index idxpart_pkey attach partition idxpart0_a_key;
--
2.34.1