Re: Custom Constraint Violation Errors - Mailing list pgsql-general

From Craig Ringer
Subject Re: Custom Constraint Violation Errors
Date
Msg-id 4EB8C1D5.7090605@ringerc.id.au
Whole thread Raw
In response to Re: Custom Constraint Violation Errors  (Richard Broersma <richard.broersma@gmail.com>)
List pgsql-general
On 11/08/2011 07:06 AM, Richard Broersma wrote:

> I'd be more maintainable to catch these errors in your client
> application.  Here you would reword these error messages according the
> business rules of your client application.

+1

It's not hard to create:

   CONSTRAINT some_constraint_name FOREIGN KEY col REFERENCES blah(id)

... then in the app, match "some_constraint_name" and map it to a
suitable error. That's what I do and it works very well for all
constraint types, not just foreign key constraints.

--
Craig Ringer

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Behavior of negative OFFSET
Next
From: Craig Ringer
Date:
Subject: Re: