Re: comparing null value in plpgsql.

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Bhuvan A <bhuvansql(at)yahoo(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: comparing null value in plpgsql.
Date: 2002-03-11 06:10:45
Message-ID: 20020310220729.O38817-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message bhuvanbk 2002-03-11 07:03:08 Re: comparing null value in plpgsql.
Previous Message Bhuvan A 2002-03-11 05:14:28 comparing null value in plpgsql.