Looking for pure C function APIs for server extension: language handler and SPI

From: <david(at)andl(dot)org>
To: <pgsql-general-owner+M220260=david=andl(dot)org(at)postgresql(dot)org>
Cc: "'Postgres General'" <pgsql-general(at)postgresql(dot)org>
Subject: Looking for pure C function APIs for server extension: language handler and SPI
Date: 2016-02-29 23:55:33
Message-ID: 002001d1734c$afe9d120$0fbd7360$@andl.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

There are 5 generic data types: boolean, binary (blob), number (decimal/real/integer), text (string/varchar), time (date/datetime). Each data type needs to be converted between the Postgres internal data types (Datum) and some intermediate data type that can be passed through a pure C API. In my case that will be C# (MS or Mono), but others might want to use Java or whatever.

These conversion tasks are identical to those needed to implement an ODBC/JDBC or similar interface, but one bound directly to the server and not going through a client (socket) connection. I have already done this successfully with Sqlite, which already provides a pure C server API and excellent documentation to go with it, so I know what it might look like.

FYI apart from these two APIs (and their 4x5 conversions), the only other thing needed is some SQL code generation and I expect to have a working language of considerable power.

Any help, suggestions, pointers much appreciated.

Regards

David M Bennett FACS

_____

Andl - A New Database Language - andl.org

Responses

Browse pgsql-general by date

  From Date Subject
Next Message drum.lucas@gmail.com 2016-03-01 01:14:10 Re: Function fixing - PostgreSQL 9.2
Previous Message Tom Lane 2016-02-29 23:39:51 Re: ERROR: cannot convert relation containing dropped columns to view