Puzzling behaviour running C Function

From: George Weaver <gweaver(at)shaw(dot)ca>
To: pgsql-novice(at)postgresql(dot)org
Subject: Puzzling behaviour running C Function
Date: 2006-03-30 15:23:06
Message-ID: 003501c6540d$d8bf6dd0$6400a8c0@Dell4500
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2006-03-30 15:32:18 Re: Puzzling behaviour running C Function
Previous Message george young 2006-03-30 15:09:12 Re: Does a connection support multiple transactions.