pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marc Zandvliet <marc@auroraworks.com>
To: pgsql-interfaces@postgresql.org
Subject: help with integrating liblpq program
Date: Wed, 24 Apr 2002 11:43:06 -0700
Message-ID: <AEEOKGDAFCLODFHEHMHCEEGGCCAA.marc@auroraworks.com> (raw)

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

Message-ID: <AEEOKGDAFCLODFHEHMHCEEGGCCAA.marc@auroraworks.com>
Permalink:  ../AEEOKGDAFCLODFHEHMHCEEGGCCAA.marc@auroraworks.com/
Also on:    postgresql.org/message-id/AEEOKGDAFCLODFHEHMHCEEGGCCAA.marc@auroraworks.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: marc@auroraworks.com
  Subject: Re: help with integrating liblpq program
  In-Reply-To: <AEEOKGDAFCLODFHEHMHCEEGGCCAA.marc@auroraworks.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox