Re: Own messages for constraints?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: hubert depesz lubaczewski <depesz(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Kacper Chrapa <k(dot)chrapa(at)wp(dot)pl>, pgsql-general(at)postgresql(dot)org
Subject: Re: Own messages for constraints?
Date: 2007-03-19 18:22:15
Message-ID: 20070319182215.GA387@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 19, 2007 at 07:08:41PM +0100, hubert depesz lubaczewski wrote:
> On 3/19/07, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> >You can use an AFTER trigger instead of a CHECK constraint (but that may
> >have a performance impact - test for your application).
>
> are you sure you meant AFTER? why? generally data-checks should be in
> before triggers. i guess.

In an AFTER trigger you can be sure you're seeing what actually got
inserted. In a BEFORE trigger other triggers after you could still
modify the data...

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrej Ricnik-Bay 2007-03-19 18:23:15 Re: UPGRADATION TO 8.1
Previous Message Magnus Hagander 2007-03-19 18:10:52 Re: cannot get build (initdb) to work after trying for a week