Re: trigger question - Mailing list pgsql-general

From Tom Lane
Subject Re: trigger question
Date
Msg-id 9642.962116390@sss.pgh.pa.us
Whole thread Raw
In response to trigger question  (mikeo <mikeo@spectrumtelecorp.com>)
Responses Re: trigger question  (mikeo <mikeo@spectrumtelecorp.com>)
List pgsql-general
mikeo <mikeo@spectrumtelecorp.com> writes:
> CREATE function rates_hist_function()
>         returns opaque
>         as 'BEGIN
>                if ( old.rt_valid <> ''P'' or new.rt_valid not in (''Y'',''N''))
                      ^^^^^^^^^^^^

> i get this error:
> ERROR:  record old is unassigned yet

> since this trigger is for both insert or update, why does it expect
> the "OLD" value to already exist, as it would not for insert?

Because you referenced it in the function code.  Am I missing something?

            regards, tom lane

pgsql-general by date:

Previous
From: Hernan Gonzalez
Date:
Subject: puzzled by the docs
Next
From: Herbert Liechti
Date:
Subject: Re: How to dump from Postgre