Puzzling behaviour running C Function - Mailing list pgsql-novice

From George Weaver
Subject Puzzling behaviour running C Function
Date
Msg-id 003501c6540d$d8bf6dd0$6400a8c0@Dell4500
Whole thread Raw
Responses Re: Puzzling behaviour running C Function
List pgsql-novice
Hi,
 
I am running PostrgreSQL 8.1 on Win X/P.
 
I have written a function in C (my first) that performs a select followed by an update.
 
The function compiles properly, installs properly and works as expected.
 
However, if I start a new shell session and install the function and immediately call the function several times consecutively, after anywhere from 3 to 7 function calls the server disconnects:
 
        server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
        The connection to the server was lost. Attempting reset: Failed.
 
On the other hand, if I install the function, end the session, start a new session and call the function, I can literally call it  a 100 times without problem.
 
On a stripped down version of the function which simply performs the select, I found that this behaviour did not occur if FOR UPDATE was not included in the select statement, but in the full function, removing FOR UPDATE only prolonged the number of times I could run the function before the server disconnected.
 
Any idea what might be causing this?
   
Thanks,
George

pgsql-novice by date:

Previous
From: george young
Date:
Subject: Re: Does a connection support multiple transactions.
Next
From: Tom Lane
Date:
Subject: Re: Puzzling behaviour running C Function