Reputation: 1670
For example I have NOT NULL field in database. I'm trying to insert NULL VALUE into it. PostgreSQL says:
ERROR: null value in column "id" violates not-null constraint
(or something like that, in my version it speeks in russian, so i find english error message in google).
How can i obtain additional information about error? Firts of all table and schema. I have to parse this error and return table, schema and field where error occurred to a higher module of my system. This info is quite easy to find in Oracle and SQL Server, but how to find them in postgre?
Same trouble with UNIQUE VIOLATION ERROR and others.
Note: this insert or update may be part of big batch command so without information from database I can't locate query where error occurred.
Upvotes: 1
Views: 750
Reputation: 45795
You have to use a regular expressions and parse error message. There are not other possibility now. This is in my ToDo, but it needs a free time.
Upvotes: 1