Re: [GENERAL] short ciruit logic of plpgsql in 8.2

2007-05-22 Thread Ian Harding
This keeps biting me. In a trigger function for INSERT OR UPDATE if you try IF TG_OP = 'UPDATE' AND OLD.foo = 'bar' THEN ... it will blow up on inserts because there is no OLD. I always expect this to short circuit and am always disappointed. Easy fix, of course... IF TG_OP = 'UPDATE' THEN

Re: [GENERAL] short ciruit logic of plpgsql in 8.2

2007-05-17 Thread Tom Lane
Richard Broersma Jr <[EMAIL PROTECTED]> writes: > Does anyone know if logic operations in plpgsql are short circuited in 8.2? They are often optimized, but if you expect "short circuiting" following exactly the rules of, say, C, you are likely to be disappointed. See the manual: http://www.postg

Re: [GENERAL] short ciruit logic of plpgsql in 8.2

2007-05-17 Thread Pavel Stehule
hello, it depends on SQL. plpgsql hasn't own arithmetic unit. You can test it simply: postgres=# create or replace function a() returns bool as $$ begin raise notice 'a'; return true; end$$ language plpgsql; CREATE FUNCTION postgres=# create or replace function b() returns bool as $$ begin rai