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


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to