Re: NOT NULL violation and error-message - Mailing list pgsql-hackers

From Takahiro Itagaki
Subject Re: NOT NULL violation and error-message
Date
Msg-id 20100112191009.C533.52131E4D@oss.ntt.co.jp
Whole thread Raw
In response to NOT NULL violation and error-message  (Andreas Joseph Krogh <andreak@officenet.no>)
Responses Re: NOT NULL violation and error-message
Re: NOT NULL violation and error-message
Re: NOT NULL violation and error-message
List pgsql-hackers
Andreas Joseph Krogh <andreak@officenet.no> wrote:

> ERROR: null value in column "created" violates not-null constraint

It is easy to add the table name to the message, but ...

> ERROR: null value in column "public"."mytable"."created" violates not-null constraint
> Oracle does this btw...

Do we have any guideline about the message for identifier names? We've
already had serveral "table.column" messages, but "schema.table.column"
might be preferred if there are tables with the same name in different
schema. In addition, separated quotes ("schema"."table"."column") are
more SQL-ish than single outer quotes. Which should we use?

At any rate, we need to adjust many regression test and .po files
if we change such kinds of messages.


Index: src/backend/executor/execMain.c
===================================================================
--- src/backend/executor/execMain.c    (HEAD)
+++ src/backend/executor/execMain.c    (fixed)
@@ -1316,7 +1316,8 @@                slot_attisnull(slot, attrChk))                ereport(ERROR,
(errcode(ERRCODE_NOT_NULL_VIOLATION),
 
-                         errmsg("null value in column \"%s\" violates not-null constraint",
+                         errmsg("null value in column \"%s.%s\" violates not-null constraint",
+                        RelationGetRelationName(rel),                        NameStr(rel->rd_att->attrs[attrChk -
1]->attname))));       }    }
 


Regards,
---
Takahiro Itagaki
NTT Open Source Software Center




pgsql-hackers by date:

Previous
From: Takahiro Itagaki
Date:
Subject: Re: plpgsql: open for execute - add USING clause
Next
From: Pavel Stehule
Date:
Subject: bug in integration SQL parser to plpgsq