plpgsql help - nested loops

Поиск
Список
Период
Сортировка
От Cedar Cox
Тема plpgsql help - nested loops
Дата
Msg-id Pine.LNX.4.21.0101030107140.28193-200000@nanu.visionforisrael.com
обсуждение исходный текст
Ответы Re: plpgsql help - nested loops  ("Robert B. Easter" <reaster@comptechnews.com>)
Список pgsql-interfaces
I'm trying to compare the fields of two loop record variables.  The loops
are nested, the compare is done inside the inner one.  If given this:
 raise notice ''sloop.serialnumber=%, rloop.serialnumber=%'',   sloop.serialnumber, rloop.serialnumber;
 if sloop.serialnumber=rloop.serialnumber then   raise notice '' SN match''; else   raise notice '' SN mis-match''; end
if;

the output is
 NOTICE:  sloop.serialnumber=<NULL>, rloop.serialnumber=<NULL> NOTICE:   SN mis-match

However, if you change the comparison to
 if sloop.serialnumber=rloop.serialnumber or   (sloop.serialnumber=null and rloop.serialnumber=null) then   raise
notice'' SN match''; else   raise notice '' SN mis-match''; end if;
 

everything is fine.

Question: does null=null evaluate to true, false, or null?  If in psql you
do SELECT null=null; it returns true.  Am I missing something?  Attached
is the full trigger code..

Thanks,
-Cedar

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: wrong values in ODBC parameters?
Следующее
От: David Wright
Дата:
Сообщение: DBD::Pg