From 38fd90df8c3f8adb8fab344ace815de7955d1bbe Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 27 Feb 2023 16:04:05 +0100 Subject: [PATCH v4 1/3] ALTER TABLE ADD PRIMARY KEY: mention table name in 'NOT NULL missing' error --- src/backend/catalog/index.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 7777e7ec77..bdf78b53ea 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -269,8 +269,8 @@ index_check_primary_key(Relation heapRel, if (!attform->attnotnull) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("primary key column \"%s\" is not marked NOT NULL", - NameStr(attform->attname)))); + errmsg("primary key column \"%s\" is not marked NOT NULL in table \"%s\"", + NameStr(attform->attname), RelationGetRelationName(heapRel)))); ReleaseSysCache(atttuple); } -- 2.30.2