Re: function crashes backend

From: Louis-David Mitterrand <cunctator(at)apartia(dot)ch>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: function crashes backend
Date: 2000-09-27 08:13:15
Message-ID: 20000927101315.A10137@styx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)apartia(dot)org - http://www.apartia.org

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message devik 2000-09-27 09:33:16 Re: pgsql is 75 times faster with my new index scan
Previous Message devik 2000-09-27 08:12:10 Re: pgsql is 75 times faster with my new index scan