Re: Custom Constraint Violation Errors

From: Michael Musenbrock <redeamer(at)gmx(dot)net>
To: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Custom Constraint Violation Errors
Date: 2011-11-07 22:47:27
Message-ID: 4EB85FFF.4020604@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am 2011-11-07 16:06, schrieb Richard Broersma:
> On Thu, Nov 3, 2011 at 11:56 PM, Michael Musenbrock <redeamer(at)gmx(dot)net> wrote:
>> But I have not
>> found any information if this is possible to create a trigger on a
>> constraint violation, and if yes, how could that be done?
> You want to use the special type of "CONSTRAINT" trigger.
>
> http://www.postgresql.org/docs/9.1/interactive/sql-createtrigger.html

Ah, thank you very much, I was already reading about the constraint
trigger, but I
was intentionally looking for a trigger firing on violating of an
already existing constraint.

So am I got that right, that If I want to have eg custom error messages
for a foreign
key violation, I need to replace all fkeys by trigger functions?!

Thanks in advance,
Regards,
Michael

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2011-11-07 22:54:27 Re: Simple question on SELECT
Previous Message Edson Richter 2011-11-07 22:41:53 Simple question on SELECT