Evaluation of if conditions - Mailing list pgsql-sql

From Daniel CAUNE
Subject Evaluation of if conditions
Date
Msg-id 001601c6d204$5d2cd840$0b00a8c0@tedy
Whole thread Raw
Responses Re: Evaluation of if conditions  (Oisin Glynn <me@oisinglynn.com>)
Re: Evaluation of if conditions  (Joe <dev@freedomcircle.net>)
Re: Evaluation of if conditions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Hi,

How does the IF statement evaluate conditions?  Does it evaluate conditions
following their declaration order from left to right?  In case of
or-conditions, does the IF statement stop evaluating conditions whenever a
first or-condition is true?

The following snippet seems to be invalid, which let me think that PL/PGSQL
evaluates all the conditions:
 IF (TG_OP = 'INSERT') OR    (OLD.bar = ...) THEN   statement END IF;

Should be rewritten as (for example):
 IF (TG_OP = 'INSERT') THEN   statement ELSIF (OLD.bar = ...) THEN   statement END IF;


Regards,

--
Daniel



pgsql-sql by date:

Previous
From: Daryl Richter
Date:
Subject: Re: Substitute a Character
Next
From: Oisin Glynn
Date:
Subject: Re: Evaluation of if conditions