Re: detecting NULL column in SPI function - Mailing list pgsql-general

From Tom Lane
Subject Re: detecting NULL column in SPI function
Date
Msg-id 26080.970154455@sss.pgh.pa.us
Whole thread Raw
In response to detecting NULL column in SPI function  (Louis-David Mitterrand <cunctator@apartia.ch>)
List pgsql-general
Louis-David Mitterrand <cunctator@apartia.ch> writes:
> In the provided example SPI functions I couldn't determine a good way of
> testing for NULL on columns. Should I first try to return the Datum,
> test it for NULL, then run DatumGetFloat64() on it? Isn't there a
> simpler way?

Yes.  No.  The Datum is a pointer, so if you indirect through it
before having checked for null-ness, you WILL get a crash.

            regards, tom lane

pgsql-general by date:

Previous
From: "Mitch Vincent"
Date:
Subject: Re: Talking with other Dbases.
Next
From: "Daryl Chance"
Date:
Subject: Fw: Talking with other Dbases.