detecting NULL column in SPI function

Поиск
Список
Период
Сортировка
От Louis-David Mitterrand
Тема detecting NULL column in SPI function
Дата
Msg-id 20000928170531.A17373@styx
обсуждение исходный текст
Ответы Re: detecting NULL column in SPI function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello,

In a SPI function I have this code snippet:

    double startprice = *DatumGetFloat64(SPI_getbinval(
                    auction_tt->vals[i], auction_tt->tupdesc,
                    SPI_fnumber(auction_tt->tupdesc, "startprice"), &isnull));

To extract a value from the startprice column. It only works if
"startprice" is not NULL, otherwise the backend crashes.

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?

Thanks in advance for your help, cheers,

--
Louis-David Mitterrand - ldm@apartia.org - http://www.apartia.org

 Hand, n.:
         A singular instrument worn at the end of a human arm and
         commonly thrust into somebody's pocket.
                         -- Ambrose Bierce, "The Devil's Dictionary"

В списке pgsql-general по дате отправления:

Предыдущее
От: "Daryl Chance"
Дата:
Сообщение: Talking with other Dbases.
Следующее
От: "Mitch Vincent"
Дата:
Сообщение: Re: Talking with other Dbases.