From gsmith@eurocom.od.ua Sat Sep 30 08:27:44 2000 Received: from Main.eurocom.od.ua (Main.EuroCom.Od.UA [212.15.128.6]) by hub.org (8.10.1/8.10.1) with ESMTP id e8U8Rhp09006 for ; Sat, 30 Sep 2000 04:27:44 -0400 (EDT) Received: from eurocom.od.ua (Farhost.eurocom.od.ua [212.15.128.162]) by Main.eurocom.od.ua (8.11.0/8.11.0) with ESMTP id e8U8Pov04000 for ; Sat, 30 Sep 2000 11:25:50 +0300 Message-ID: <39D5A404.8865FC11@eurocom.od.ua> Date: Sat, 30 Sep 2000 11:27:48 +0300 From: "Vladimir V. Zolotych" X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-admin@postgreSQL.org Subject: postgres functions(.so) Content-Type: multipart/alternative; boundary="------------FC4066F200AF77FD707DEA33" X-Archive-Number: 200009/80 --------------FC4066F200AF77FD707DEA33 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Hello Can anybody help me? The question is: Is it possible to write postgres function on C/C++ that selects some tables of a database ? More detailed description. Suppose I have database with tables A, B. I've written program on C++ with 'main' function that reads tables A, B and returns some value, e.g. integer. Now I'd like to implement the same actions as postgres function (e.g. as .so module). Is it possible ? I know: 1) How compile C/C++ code to .so 2) How to CREATE FUNCTION ..... I don't know: 1) Is it possible to postges function to read tables of the database 2) If possible, how it should be done? 3) Which restrictions applicable to .so functions ? If you know examples those do something similar, please let me know. Any help will be appreciated. Thanks -- Vladimir Zolotych gsmith@eurocom.od.ua --------------FC4066F200AF77FD707DEA33 Content-Type: text/html; charset=koi8-r Content-Transfer-Encoding: 7bit   Hello

Can anybody help me?
The question is: Is it possible to write
postgres function on C/C++ that selects
some tables of a database ?

More detailed description.
Suppose I have database with tables A, B.
I've written program on C++ with 'main' function
that reads tables A, B and returns some value, e.g. integer.
Now I'd like to implement the same actions as postgres
function (e.g. as .so module).

Is it possible ?

I know:
    1) How compile C/C++ code to .so
    2) How to CREATE FUNCTION .....
I don't know:
    1) Is it possible to postges function
       to read tables of the database
    2) If possible, how it should be done?
    3) Which restrictions applicable to .so
       functions ?

If you know examples those do something similar,
please let me know.

Any help will be appreciated.

Thanks
 

-- 
Vladimir Zolotych                         gsmith@eurocom.od.ua
  --------------FC4066F200AF77FD707DEA33-- From pgman@candle.pha.pa.us Sat Oct 7 23:01:48 2000 Received: from candle.pha.pa.us (pgman@nav-43.dsl.navpoint.com [162.33.245.46]) by hub.org (8.10.1/8.10.1) with ESMTP id e97N1mJ63833 for ; Sat, 7 Oct 2000 19:01:48 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.9.0/8.9.0) id TAA03123; Sat, 7 Oct 2000 19:01:21 -0400 (EDT) From: Bruce Momjian Message-Id: <200010072301.TAA03123@candle.pha.pa.us> Subject: Re: postgres functions(.so) In-Reply-To: <39D5A404.8865FC11@eurocom.od.ua> "from Vladimir V. Zolotych at Sep 30, 2000 11:27:48 am" To: "Vladimir V. Zolotych" Date: Sat, 7 Oct 2000 19:01:21 -0400 (EDT) CC: pgsql-admin@postgreSQL.org X-Mailer: ELM [version 2.4ME+ PL77 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200010/38 You can read a brief introduction in chapter 19 of my book at: http://www.postgresql.org/docs/awbook.html Sounds like you want to use the SPI interface. See the PostgreSQL manuals for more information. [ Charset KOI8-R unsupported, converting... ] > Hello > > Can anybody help me? > The question is: Is it possible to write > postgres function on C/C++ that selects > some tables of a database ? > > More detailed description. > Suppose I have database with tables A, B. > I've written program on C++ with 'main' function > that reads tables A, B and returns some value, e.g. integer. > Now I'd like to implement the same actions as postgres > function (e.g. as .so module). > > Is it possible ? > > I know: > 1) How compile C/C++ code to .so > 2) How to CREATE FUNCTION ..... > I don't know: > 1) Is it possible to postges function > to read tables of the database > 2) If possible, how it should be done? > 3) Which restrictions applicable to .so > functions ? > > If you know examples those do something similar, > please let me know. > > Any help will be appreciated. > > Thanks > > > -- > Vladimir Zolotych gsmith@eurocom.od.ua > > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026