plpgsql - or operator? - Mailing list pgsql-general

From MadHatter
Subject plpgsql - or operator?
Date
Msg-id 5E3E637A-61D5-44BA-8A7D-F49DB6711B52@Hattersoft.com
Whole thread Raw
In response to predefined animation and pre-recorded sounds in postgresql  (aravind chandu <avin_friends@yahoo.com>)
Responses Re: plpgsql - or operator?
List 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 J

pgsql-general by date:

Previous
From: "Nikolay Samokhvalov"
Date:
Subject: Happy birthday!
Next
From: Ow Mun Heng
Date:
Subject: Re: Quick way to alter a column type?