Skip site navigation (1) Skip section navigation (2)

Re: trigger question

From: mikeo <mikeo(at)spectrumtelecorp(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: trigger question
Date: 2000-06-27 15:50:09
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
At 11:27 AM 6/27/00 -0400, Tom Lane wrote:
>mikeo <mikeo(at)spectrumtelecorp(dot)com> writes:
>> in oracle, the triggers were smart enough to know not to reference
>> an old value on insert in an "insert or update" trigger procedure,
>> apparently.
>> this is the original oracle trigger that works fine 
>> with the same insert statement:
>> CREATE OR REPLACE TRIGGER rates_hist_trigger
>>         before insert or update on rates
>>         for each row
>>              WHEN (old.rt_valid <> 'P' or new.rt_valid not in ('Y','N'))
>Hmm.  It sounds to me like Oracle treats the OLD fields as being NULL
>if the context is INSERT, which is something we could certainly do at
>the price of losing some error detection capability --- ie, if that
>really had been a typo as I first thought, the system wouldn't flag it
>for you.
>Not sure which way is better.  Comments anyone?
>			regards, tom lane

it would make the insert or update trigger more flexible, and ,
truly by an insert or update procedure, IMHO :), but is definitely not 
a priority.  creating a rule for each is just as quick as writing a 
function with a trigger to call it.


In response to


pgsql-general by date

Next:From: Hernan GonzalezDate: 2000-06-27 16:37:55
Subject: Re: puzzled by the docs
Previous:From: Vince VielhaberDate: 2000-06-27 15:37:57
Subject: Re: puzzled by the docs

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group