Accessing Database Data from C Function

From: jeffrey(dot)bigham(at)gmail(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Accessing Database Data from C Function
Date: 2006-08-08 19:16:18
Message-ID: 1155064578.473986.228960@b28g2000cwb.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christoph Pingel 2006-08-08 19:53:31 Re: DISTINCT to get distinct *substrings*?
Previous Message Christoph Pingel 2006-08-08 18:52:35 Re: DISTINCT to get distinct *substrings*?