User Defined Types in Java

From: Thomas Hallgren <thomas(at)tada(dot)se>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: User Defined Types in Java
Date: 2006-02-09 12:08:01
Message-ID: 43EB30A1.7090308@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I'd like to enable UDT's written in Java and made some initial trial and
error. I don't get very far. Here's what I do:

I take the 'complex' type example described in '31.11 User-Defined
Types' and change it to use Java functions (see below). But I get:

ERROR: type "complex" does not exist

as soon as I execute the first CREATE statement. If I change the
language from java to C and try again, the message is different (and
more according to the docs):

NOTICE: type "complex" is not yet defined
DETAIL: Creating a shell type definition.

The documentation says "Creating a new base type requires implementing
functions to operate on the type in a low-level language, usually C". I
read that as it would be possible to use other languages. Apparently
java is not one of them. What can I do to change that?

Kind regards,
Thomas Hallgren

CREATE FUNCTION complex_in(cstring)
RETURNS complex
AS 'org.postgresql.pljava.example.Complex.in'
LANGUAGE java IMMUTABLE STRICT;

CREATE FUNCTION complex_out(complex)
RETURNS cstring
AS 'org.postgresql.pljava.example.Complex.out'
LANGUAGE java IMMUTABLE STRICT;

CREATE FUNCTION complex_recv(internal)
RETURNS complex
AS 'org.postgresql.pljava.example.Complext.recv'
LANGUAGE java IMMUTABLE STRICT;

CREATE FUNCTION complex_send(complex)
RETURNS bytea
AS 'org.postgresql.pljava.example.Complext.send'
LANGUAGE java IMMUTABLE STRICT;

CREATE TYPE complex (
internallength = 16,
input = complex_in,
output = complex_out,
receive = complex_recv,
send = complex_send,
alignment = double
);

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message korry 2006-02-09 12:09:50 Re: pg_hba.conf alternative
Previous Message Alexander Schreiber 2006-02-09 10:34:07 Re: Upcoming re-releases