plpgsql help - nested loops - Mailing list pgsql-interfaces

From Cedar Cox
Subject plpgsql help - nested loops
Date
Msg-id Pine.LNX.4.21.0101030107140.28193-200000@nanu.visionforisrael.com
Whole thread Raw
Responses Re: plpgsql help - nested loops  ("Robert B. Easter" <reaster@comptechnews.com>)
List 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 by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: wrong values in ODBC parameters?
Next
From: David Wright
Date:
Subject: DBD::Pg