On Mon, 11 Mar 2002, Bhuvan A wrote:

> here i have a problem in comparing null values in plpgsql. this exist
> in 7.1.x and 7.2 as well.
>
> the condition <null value> != <valid value> fails in plpgsql.
> consider this function is triggered on every updation on a table.
>
>   create function ftest()
>   returns opaque as 'declare
>
>   begin
>
>     if new.comp_code != old.comp_code then
>       ...
>     end if;
>     return new;
>   end;'
>   language 'plpgsql';
>
> this condition fails if old.comp_code is null and new.comp_code has
> some value.

<nullvalue> != <anything> is not true, it's unknown, so the if shouldn't
fire.  It's a side effect of how the spec defines operations on nulls.



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to