Re: SPI_exec doesn't return proc context (on 9.1)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SPI_exec doesn't return proc context (on 9.1)
Дата
Msg-id 14878.1296329875@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SPI_exec doesn't return proc context (on 9.1)  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: SPI_exec doesn't return proc context (on 9.1)  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> I am playing with demos for PostgreSQL's Prague Developer Day and I
> found a strange behave. SPI_exec should to return to proc context. But
> it isn't true.

Yes it is.

> In following demo, I have to play with MemoryContext
> when I would to get a correct result. Is it ok?

The commented-out lines of code don't appear to have anything to do with
what you claim the problem is.  What it looks to me like you're doing is
copying the result out to the function's calling context, which is not
either of the SPI contexts established by SPI_connect (and removed by
SPI_finish).

The less crocky way to do that is to use SPI_palloc() for something that
should be allocated in the outer context.
        regards, tom lane


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

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: WIP: RangeTypes
Следующее
От: Tom Lane
Дата:
Сообщение: Re: WIP: RangeTypes