Hi all, when trying to insert/update a NOT NULL column with a null-values (in 
this case the "created"-column), we get this error:

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 table the NOT_NULL_VIOLATION happened 
in. This can be a real pain as this might happen upon transaction-commit using 
OR-tools like Hibernate. The transaction might involve updating several tables 
with the same column-name rendering it impossible to extract what the error 
really is from the error-message. Is there a way to prefix the column-name in 
the error-message with 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 <andr...@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 |                                             |
------------------------+---------------------------------------------+

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to