comparing null value in plpgsql.

From: Bhuvan A <bhuvansql(at)yahoo(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: comparing null value in plpgsql.
Date: 2002-03-11 05:14:28
Message-ID: Pine.LNX.4.20.0203111029130.23906-100000@Larry
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2002-03-11 06:10:45 Re: comparing null value in plpgsql.
Previous Message Peter T Mount 2002-03-09 11:50:08 Fwd: Bug in getTimestamp() of PostgreSQL JDBC driver?