plpgsql FOUND bug when SELECT INTO assigns a NULL value?

Поиск
Список
Период
Сортировка
От Karl O. Pinc
Тема plpgsql FOUND bug when SELECT INTO assigns a NULL value?
Дата
Msg-id 1161310963l.20924l.8l@mofo
обсуждение исходный текст
Ответы Re: plpgsql FOUND bug when SELECT INTO assigns a NULL value?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,

The docs say:

  A SELECT INTO statement sets FOUND true if it returns a row,
  false if no row is returned.

I'm running a plpgsql procedure from a trigger and
am doing a "SELECT INTO foo bar ..." where a row
matches the selection criteria, but the value of
that row's bar column is NULL.  The next statement
is "IF NOT FOUND THEN" and the THEN clause is
being taken.

I would expect that because a row exists, even
though the value assigned is NULL, FOUND would
be TRUE.  Are my expectations wrong?

(If so then the docs could use some clarification.
I'll also have to write a PERFORM to test for
the existance of the row followed by a SELECT
INTO to get a (possibly NULL) value.  Is
there a better way to write such code?)

Thanks.

---------------------------------

  select version();
                                                 version
-------------------------------------------------------------------------------------------------------
  PostgreSQL 8.1.3 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC)
3.4.4 20050721 (Red Hat 3.4.4-2)
(1 row)


Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."
                  -- Robert A. Heinlein


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SQL function inlining
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: PostGIS