Re: [GENERAL] shortcircuit logic in plpsql

2006-07-18 Thread Tom Lane
Joseph Shraibman writes: > Does plpgsql not short circuit its logic? We make no guarantees about evaluation order. In the particular case at hand, you're losing because plpgsql has to evaluate all the variables that it's going to pass into the SQL engine for that expression. Break it into two

[GENERAL] shortcircuit logic in plpsql

2006-07-18 Thread Joseph Shraibman
I'm trying to do this: IF TG_OP = \'INSERT\' OR (TG_OP = \'UPDATE\' AND OLD.status <> NEW.status) THEN ..but pg is complaining: ERROR: record "old" is not assigned yet DETAIL: The tuple structure of a not-yet-assigned record is indeterminate. CONTEXT: PL/pgSQL function "set_dir_count" lin