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

From Andreas Joseph Krogh
Subject NOT NULL violation and error-message
Date
Msg-id 201001082255.00602.andreak@officenet.no
Whole thread Raw
Responses Re: NOT NULL violation and error-message  (Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>)
List pgsql-hackers
Hi all, when trying to insert/update a NOT NULL column with a null-values (in this case the "created"-column), we get
thiserror: 

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

Using JDBC this error-message is what appears in the SQLException.getMessage() which makes it impossible to tell which
tablethe NOT_NULL_VIOLATION happened in. This can be a real pain as this might happen upon transaction-commit using
OR-toolslike Hibernate. The transaction might involve updating several tables with the same column-name rendering it
impossibleto extract what the error really is from the error-message. Is there a way to prefix the column-name in the
error-messagewith table-name and maybe also schema-name? The message would then instead read something like: 

ERROR: null value in column "public"."mytable"."created" violates not-null constraint

Oracle does this btw...

--
Andreas Joseph Krogh <andreak@officenet.no>
Senior Software Developer / CTO
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Rosenholmveien 25       | know how to do a thing and to watch         |
1414 Trollåsen          | somebody else doing it wrong, without       |
NORWAY                  | comment.                                    |                       |
                   | 
Tlf:    +47 24 15 38 90 |                                             |
Fax:    +47 24 15 38 91 |                                             |
Mobile: +47 909  56 963 |                                             |
------------------------+---------------------------------------------+


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Serializable implementation
Next
From: Josh Berkus
Date:
Subject: Re: Streaming replication status