Re: Executing a query and returning the result set using the SPI
В списке pgsql-general по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Executing a query and returning the result set using the SPI |
| Дата | |
| Msg-id | 5083.1075570069@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Executing a query and returning the result set using the SPI (Nuno Morgadinho <neqm@lockstep.org>) |
| Список | pgsql-general |
Nuno Morgadinho <neqm@lockstep.org> writes:
> Ideally, I would want to make the example function return the
> information as a "set" and not through elog() so I can later access it
> and print it using PHP.
> I have a few ideas on how this can be accomplished but I haven't found
> any simple example to fully elucidate me.
I think your problem comes from having done
SPI_connect/SPI_exec/SPI_finish every time through the function. Aside
from being really inefficient, this means that after the first call, the
tuple slot you built in the first call has a dangling pointer to a
tupdesc that doesn't exist anymore. You want to do SPI_connect and
SPI_exec only during the FIRSTCALL sequence, and do SPI_finish just
before returning for the last time.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера