Re: [HACKERS] NULL handling question
Thomas Lockhart <lockhart@alumni.caltech.edu>
From: Thomas Lockhart <lockhart@alumni.caltech.edu>
To: "Vazsonyi Peter[ke]" <neko@kornel.szif.hu>
Cc: hackers@postgreSQL.org
Date: 1999-03-29T15:47:15Z
Lists: pgsql-hackers
> I don't seek this in the source, but i think, all function, who take a
> NULL value as parameter can't return with a NOT NULL value.
> But why?
Postgres assumes that a NULL input will give a NULL output, and never
calls your routine at all. Since NULL means "don't know", there is a
strong argument that this is correct behavior.
> And can i check about an int4 if IS NULL ?
Not as cleanly as the pass-by-reference data types. I vaguely recall
that the input and output routines can look for a second or third
argument, one of which is a NULL indicator. But that mechanism is not
generally usable in other contexts afaik.
- Tom