Re: trigger question - Mailing list pgsql-general

From Tom Lane
Subject Re: trigger question
Date
Msg-id 10011.962119639@sss.pgh.pa.us
Whole thread Raw
In response to Re: trigger question  (mikeo <mikeo@spectrumtelecorp.com>)
Responses Re: trigger question  (mikeo <mikeo@spectrumtelecorp.com>)
List pgsql-general
mikeo <mikeo@spectrumtelecorp.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

pgsql-general by date:

Previous
From: mikeo
Date:
Subject: Re: trigger question
Next
From: Vince Vielhaber
Date:
Subject: Re: puzzled by the docs