plpgsql - or operator?

From: "MadHatter" <madhtr(at)schif(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: plpgsql - or operator?
Date: 2008-07-08 21:46:29
Message-ID: 5E3E637A-61D5-44BA-8A7D-F49DB6711B52@Hattersoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If I have an expression (a or b)a where a=TRUE and b=FALSE, why is b
evaluated? Any true operand before an or operator means the entire
expression is true .

---------------------------- EXAMPLE

create or replace function pinsusers() returns trigger as

$$

declare msg varchar;

begin

--THROWS EXCEPTION when ((TG_OP = 'INSERT') is TRUE "record old
is not assigned yet"

msg = ((TG_OP = 'INSERT') or (new.password<>old.password));

raise exception '%',msg;

return new;

end

$$ language plpgsql;

------------------------------------------------------

TY :-)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Dennis 2008-07-08 21:53:18 array sort for varchar arrays?
Previous Message Raymond O'Donnell 2008-07-08 21:40:52 Re: predefined animation and pre-recorded sounds in postgresql