From: | "David Bennett" <davidb(at)pfxcorp(dot)com> |
---|---|
To: | <pgsql-general-owner+M220325=david=andl(dot)org(at)postgresql(dot)org>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Looking for pure C function APIs for server extension: language handler and SPI |
Date: | 2016-03-02 13:29:44 |
Message-ID: | 000201d17487$965513a0$c2ff3ae0$@pfxcorp.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of John R Pierce
Sent: Wednesday, 2 March 2016 1:30 PM
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Looking for pure C function APIs for server extension: language handler and SPI
On 2/29/2016 3:55 PM, david(at)andl(dot)org <mailto:david(at)andl(dot)org> wrote:
What I need (to find or create) is a ‘pure’ C language API to support a Postgres server extension. By ‘pure’ I mean one that has no knowledge of Postgres internals and that could be called by a generic interface provided by some other tool that can support C language APIs.
The reason is that I’m looking to integrate a new language (Andl) into Postgres. To do that I need to find or create a ‘pure’ C-language API to interface with:
1. The generic language call interface (pl_language_handler), which must handle conversion of Incoming language call parameters and outgoing language call return value.
1. The backend query execution interface (SPI), which must handle conversion of outgoing query parameters and incoming query result values.
by "server extension" do you mean, you want to use Andi as a "PL/Andi" so you can write stored procedures i Andi callable within SQL queries?
Yes, more or less. The end result will probably be a little different for reasons that don’t matter here, but that would be a possible outcome.
I’ve gone through all the existing PL/xxx implementations and they all finish up with 10K lines of laborious C code. That’s 6 months’ work! I know I can write the code much faster in C++ or C#, but many of the access routines are exposed only as ‘impure’ C code such as macros, #defines, global variables, etc. I want to write a minimum layer of C code, exposing a ‘pure’ C API, and do most of the work (eg conversions), in a higher level language.
Sorry if I’m not explaining it well, but it’s not an easy thing to get across.
or do you mean, you want your Andi programs to be able to execute normal postgresql queries as a regular client ?
No, not this. Server-side only.
for the first, see
http://www.postgresql.org/docs/9.5/static/plhandler.html
I know it well. I have a working sample [but it keeps crashing. The rules are not easy to work out and the docs are thin.]
I was hoping to turn up some project or sample that would get me further along, and faster.
for the latter, see
http://www.postgresql.org/docs/9.5/static/libpq.html
--
john r pierce, recycling bits in santa cruz
From | Date | Subject | |
---|---|---|---|
Next Message | Rémi Cura | 2016-03-02 13:57:47 | Re: bloated postgres data folder, clean up |
Previous Message | Alexander Farber | 2016-03-02 12:39:45 | Re: How to ensure that a stored function always returns TRUE or FALSE? |