Re: Triggers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Triggers
Date: 2002-08-16 14:14:02
Message-ID: 7414.1029507242@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Oliver Elphick <olly(at)lfix(dot)co(dot)uk> writes:
>> Unfortunately the column is defined as not null so I fear the insert
>> would fail and the trigger never get called. How can I get around this?

> Surely you can use a BEFORE trigger, can't you?

I think we check constraints (including NOT NULL) before firing
triggers.

The simple answer to this is not to use a constraint, but to rely on
insert and update triggers to substitute for a null (or throw an error)
in that column.

regards, tom lane

In response to

Responses

  • Re: Triggers at 2002-08-16 14:27:27 from Jean-Christian Imbeault
  • Re: Triggers at 2002-08-16 15:08:45 from Oliver Elphick

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Christian Imbeault 2002-08-16 14:27:27 Re: Triggers
Previous Message Roj Niyogi 2002-08-16 14:10:49 Re: Good PL/pgSQL ressources>