From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | <amit(dot)mishra(at)myrealbox(dot)com>, <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: Bug #701: pqReadData() -- backend closed the channel |
Date: | 2002-06-29 21:21:02 |
Message-ID: | 20020629141216.E51866-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Sat, 29 Jun 2002 pgsql-bugs(at)postgresql(dot)org wrote:
> Short Description
> pqReadData() -- backend closed the channel unexpectedly.
>
> Long Description
> i have to fire a trigger whenever insertion is done on a table users
> that calls the postgres function which inturn calls a c function .
> wheever i am doing the insertion in the table it gives the followng error & terminates the backend:
>
> pqReadData() -- backend closed the channel unexpectedly.
> This probably means the backend terminated abnormally
> before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
>
> i cannot find the solution to this problem .please help.
>
> Sample Code
> the c file that contains function is as follows:
>
> #include <stdio.h>
> #include "pgsql/postgres.h"
> void users();
>
> int main()
> {
> users();
> }
>
> void users()
> {
> FILE *fp;
> fp = fopen("/home/suresh/trigger/test.txt","w");
> fputs("Hello this is c function",fp);
> }
I don't believe this is a valid trigger function. Looking at
the trigger documentation's simple example, I think the
function should return Datum and take PG_FUNCTION_ARGS (or
technically what that expands to, but...). I also think you
need a PG_FUNCTION_INFO_V1(users); and the function should
return the new row since you're using it as a before trigger.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-06-30 00:01:18 | Re: Bug #701: pqReadData() -- backend closed the channel unexpectedly. |
Previous Message | pgsql-bugs | 2002-06-29 11:23:42 | Bug #701: pqReadData() -- backend closed the channel unexpectedly. |