Short circuit operations in plpgsql?

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Short circuit operations in plpgsql?
Date: 2004-12-20 19:39:52
Message-ID: 20041220193952.GA9689@gp.word-to-the-wise.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have some triggers. They need to do stuff when a new row is inserted
or when the value of a particular field changes.

So, something like:

IF TG_OP='INSERT' OR NEW.foo != OLD.foo THEN
-- do stuff
END IF;
RETURN NEW;

Is there anything that guarantees that the NEW.foo != OLD.foo won't
be evaluated (and hence fail, as there is no OLD) on an insert?

Cheers,
Steve

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2004-12-20 19:44:16 Re: Diskspace
Previous Message Jeff MacDonald 2004-12-20 19:21:51 Re: Diskspace