Re: [HACKERS] NULL handling question - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: [HACKERS] NULL handling question
Date
Msg-id 36FFA083.E716298B@alumni.caltech.edu
Whole thread Raw
In response to NULL handling question  ("Vazsonyi Peter[ke]" <neko@kornel.szif.hu>)
Responses Re: [HACKERS] NULL handling question
Re: [HACKERS] NULL handling question
List 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] signal weirdness
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] libpq++