help with integrating liblpq program

From: "Marc Zandvliet" <marc(at)auroraworks(dot)com>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: help with integrating liblpq program
Date: 2002-04-24 18:43:06
Message-ID: AEEOKGDAFCLODFHEHMHCEEGGCCAA.marc@auroraworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hello,

I've written a small program in C that does a series of SELECTs on my database (sort of a recursive search). I can run the program from the command-line without any trouble - however I want to be able to run the function from within psql.

My compilation seems to be ok:

bash-2.04$ gcc -I/usr/include/postgresql -c -o event_tree.o event_tree.c
bash-2.04$ gcc -shared -lpq -o event_tree.so event_tree.o
bash-2.04$

In psql I can create the function:
efsbovic=# create function event_tree(char) returns char as '/var/lib/pgsql/temp/event_tree.so' language 'c';
CREATE
efsbovic=# select event_tree('40');
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.
!#

But as you can see it dies horribly.

I think I'm close - can someone help me out? If I want the function to do this do I still use libpq-fe functions within the C program or is there another way?

regards, Marc

Browse pgsql-interfaces by date

  From Date Subject
Next Message Yuemin Zhang 2002-04-24 20:07:29 ecpg error code -601
Previous Message "." 2002-04-24 00:01:19 Re: getting value of just inserted rows