Re: user defined functions

From: nconway(at)klamath(dot)dyndns(dot)org (Neil Conway)
To: Alison Stevenson <as(at)it-innovation(dot)soton(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: user defined functions
Date: 2002-06-27 14:00:09
Message-ID: 20020627140008.GA26194@klamath.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)rogers(dot)com>
PGP Key ID: DB3C29FC

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Curt Sampson 2002-06-27 14:02:57 Re: Still problems with memory swapping and server load
Previous Message Curt Sampson 2002-06-27 13:59:25 Re: What is a tuple?