comparing null value in plpgsql.

Поиск
Список
Период
Сортировка
От Bhuvan A
Тема comparing null value in plpgsql.
Дата
Msg-id Pine.LNX.4.20.0203111029130.23906-100000@Larry
обсуждение исходный текст
Ответы Re: comparing null value in plpgsql.  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список 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.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Peter T Mount
Дата:
Сообщение: Fwd: Bug in getTimestamp() of PostgreSQL JDBC driver?
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: comparing null value in plpgsql.