Re: user defined functions - Mailing list pgsql-general

From nconway@klamath.dyndns.org (Neil Conway)
Subject Re: user defined functions
Date
Msg-id 20020627140008.GA26194@klamath.dyndns.org
Whole thread Raw
In response to user defined functions  ("Alison Stevenson" <as@it-innovation.soton.ac.uk>)
List pgsql-general
On Thu, Jun 27, 2002 at 09:44:08AM +0100, Alison Stevenson wrote:
> Firstly, am I correct in thinking that user-defined functions cannot
> be written in C++ or Java? (The FAQ gives C, SQL, PL/pgSQL, Tcl,
> Perl, Python, or Ruby as the only possibilities)

UDFs can be written in Java using http://pljava.sf.net.

You can write UDFs in C++ -- as long as the single function you tell
Postgres about (the "entry point" into the C++ code) is defined with C
linkage (extern "C" { ... }).

> Secondly what sort of SQL interface to the user defined functions
> is available? For example if I defined a 'distance' function to
> compare two feature_vectors stored as BLOBs can I call
>     t1.feature_vector.distance(t2.feature_vector)

No -- you can call distance(t1.feature_vector, t2.feature_vector)
though.

Cheers,

Neil

--
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC



pgsql-general by date:

Previous
From: Curt Sampson
Date:
Subject: Re: What is a tuple?
Next
From: Curt Sampson
Date:
Subject: Re: Still problems with memory swapping and server load