Accessing Database Data from C Function - Mailing list pgsql-general

From jeffrey.bigham@gmail.com
Subject Accessing Database Data from C Function
Date
Msg-id 1155064578.473986.228960@b28g2000cwb.googlegroups.com
Whole thread Raw
Responses Re: Accessing Database Data from C Function  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
Hello,

I'd like to write a C Function for Postgresql that can access data in
the database, use that to conduct additional queries to find more
information in the database and eventually return a result.  I
currently have the functionality I want implemented as php/C programs
that first connect to the database, do the processing and then
disconnect, but I want to make it what I think is called a "stored
procedure" in other databases.  It seems odd that I would write a C
program to be included in the database that connects to  the localhost
- is that what I should do?  Is that somehow more efficient than
running it as a separate process?

I've looked into C Functions but the examples I've found have talked
about performing calculations on the arguments.  Table function
examples show how I might return more than one row or multi-columned
rows, but I don't see how to actually access the data in the database.

I apologize if this question is answered somewhere.  I suspect it is
but I apparently don't know the terminology to look it up and have
spent an hour conducting fruitless Google searches.  A pointer to such
a resource along with the topic I should check out would be more than
helpful.

Thanks,
Jeff


pgsql-general by date:

Previous
From: gpap@ifrance.com
Date:
Subject: sizing of a server
Next
From: Alvaro Herrera
Date:
Subject: Re: Does DROP TABLE free up disk space immediately?