Short circuit operations in plpgsql? - Mailing list pgsql-general

From Steve Atkins
Subject Short circuit operations in plpgsql?
Date
Msg-id 20041220193952.GA9689@gp.word-to-the-wise.com
Whole thread Raw
Responses Re: Short circuit operations in plpgsql?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-general by date:

Previous
From: Jeff MacDonald
Date:
Subject: Re: Diskspace
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Diskspace