Re: difficulty extracting variable-sized field on triggered row

Поиск
Список
Период
Сортировка
От Glen W. Mabey
Тема Re: difficulty extracting variable-sized field on triggered row
Дата
Msg-id 20071204161104.GD14370@bams.ccf.swri.edu
обсуждение исходный текст
Ответ на Re: difficulty extracting variable-sized field on triggered row  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: difficulty extracting variable-sized field on triggered row
Re: difficulty extracting variable-sized field on triggered row
Список pgsql-general
On Tue, Dec 04, 2007 at 09:53:37AM -0600, Tom Lane wrote:
> "Glen W. Mabey" <Glen.Mabey@swri.org> writes:
> > Is there somewhere that I am not adequately checking for an error?
>
> 1. You're passing SPI_getbinval an uninitialized bool pointer.

Doh!

> 2. You're discarding its result, which you need.

Ah yes, a change I made while trying to debug things.

> 3. You're not checking for a null, and the error check you do have
>    is wrong/redundant.

The field is constrained to be NOT NULL, so I wasn't worried about
checking that, but I don't see how the error check is wrong, according
to the description of SPI_getbinval at

http://www.postgresql.org/docs/8.2/interactive/spi-spi-getbinval.html

What is then the appropriate way to check for failure of SPI_getbinval?

> 4. Use DatumGetTextP(), not DatumGetPointer nor PG_DETOAST_DATUM.

Searching for DatumGetTextP from the search text box at the top of
www.postgresql.org yields no hits, and a google search on DatumGetTextP
does not seem to turnip [sic] any direct documentation on this function.

Is there somewhere in the docs that I should have found this (and other
useful) functions?

Thank you very much,
Glen Mabey

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: WAL shipping question
Следующее
От: Ivan Sergio Borgonovo
Дата:
Сообщение: Re: stored procedures and dynamic queries