Re: comparing null value in plpgsql.

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

On Mar 10, Stephan Szabo wrote:

> 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

what do you mean by <nullvalue> != <anything>?

> fire. It's a side effect of how the spec defines operations on nulls.
>

here i mean..

if <nullvalue> != <not null value>, the loop is not fired, but else loop is
getting fired. why?

Regards,
Bhuvaneswaran.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2002-03-11 08:09:54 Bug #612: PostgreSQL 7.2 does not build according to documentation under IRIX w/ MIPSpro
Previous Message pgsql-bugs 2002-03-11 07:08:20 Bug #611: configure script produces incorrect results under IRIX