hi,

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. 

to overcome this, i am practicing..

  create function ftest()
  returns opaque as 'declare

  begin

    if  new.comp_code is not null and
        old.comp_code is null then
        ...
    else if new.comp_code != old.comp_code then
      ...
    end if;
    end if;

    return new;
  end;'
  language 'plpgsql';

is it really a bug or i am wrong? let me know. if its a bug, when can we
expect the fix?

kindly apologize if it has been already discussed.

Regards,
Bhuvaneswaran.



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to