Re: Custom Constraint Violation Errors

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
Cc: Michael Musenbrock <redeamer(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Custom Constraint Violation Errors
Date: 2011-11-08 05:44:53
Message-ID: 4EB8C1D5.7090605@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-11-08 05:51:01 Re:
Previous Message Tom Lane 2011-11-08 04:30:46 Re: Behavior of negative OFFSET