Re: detecting NULL column in SPI function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ldm(at)apartia(dot)ch
Cc: PGSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: detecting NULL column in SPI function
Date: 2000-09-28 15:20:55
Message-ID: 26080.970154455@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Louis-David Mitterrand <cunctator(at)apartia(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2000-09-28 15:21:16 Re: Talking with other Dbases.
Previous Message Louis-David Mitterrand 2000-09-28 15:05:31 detecting NULL column in SPI function