From: | Andreas Joseph Krogh <andreak(at)officenet(dot)no> |
---|---|
To: | "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | NOT NULL violation and error-message |
Date: | 2010-01-08 21:55:00 |
Message-ID: | 201001082255.00602.andreak@officenet.no |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 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 <andreak(at)officenet(dot)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 | |
------------------------+---------------------------------------------+
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Meskes | 2010-01-08 21:57:36 | Re: pgsql: Also update ChangerLog file. |
Previous Message | Merlin Moncure | 2010-01-08 21:23:11 | Re: Listen / Notify - what to do when the queue is full |