| От | Tom Lane |
|---|---|
| Тема | Re: Docbug, SPI_getbinval, triger example |
| Дата | |
| Msg-id | 8692.1007143397@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Docbug, SPI_getbinval, triger example (mlw <markw@mohawksoft.com>) |
| Список | pgsql-hackers |
mlw <markw@mohawksoft.com> writes:
> The docs suggest that this:
> /* Get number of tuples in relation */
> ret = SPI_exec("select count(*) from ttest", 0);
Mph. The example *used* to be right, but is not as of 7.2, because
count() now returns int8 which is pass-by-reference. Your proposed
fix isn't quite right either (you'd have noticed the difference between
*int and *int8 on a big-endian machine ;-)). Probably we should change
the example to read
i = (int) DatumGetInt64(SPI_getbinval(...));
Alternatively the example query could be changed to
ret = SPI_exec("select count(*)::int4 from ttest", 0);
so as to avoid the backend version dependency. Comments anyone?
regards, tom lane
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера