Re: function crashes backend

Поиск
Список
Период
Сортировка
От Louis-David Mitterrand
Тема Re: function crashes backend
Дата
Msg-id 20000927101315.A10137@styx
обсуждение исходный текст
Ответ на function crashes backend  (Louis-David Mitterrand <cunctator@apartia.ch>)
Список pgsql-hackers
On Wed, Sep 27, 2000 at 08:53:58AM +0200, Louis-David Mitterrand wrote:
> Hello,
> 
> I am writing a SPI function to run maintenance tasks on my auction
> system but it keeps crashing the backend after running only one loop.
> Now, I am not a C programmer, nor do I have any formal training in CS. I
> thought I might run this function by you guys so that a cursory look
> might reveal some obvious coding mistake? 
> 
> Thanks in advance for your insight.

Following up to myself, I finally understood my problem: I was trying to
re-use SPI_tuptable->vals[i] after calling SPI_exec() on another,
unrelated query. So the backend crash makes perfect sense now.

What is the best strategy: 
- store the result of a SELECT returning multiple tuples into a local SPITupleTable? How do I allocate memory for
that?
- iterate over all values contained in the tuples and store _them_ into char**, int*, arrays, before re-running
SPI_exec()on the second query?
 

TIA

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

> Any suggestions for setting up WinCVS client + (server) on NT4?
Run away screaming in terror.                --Toby.


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

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: pgsql is 75 times faster with my new index scan
Следующее
От: devik@cdi.cz
Дата:
Сообщение: Re: pgsql is 75 times faster with my new index scan