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
IMMUTABLESTRICT;
CREATE FUNCTION complex_out(complex) RETURNS cstring AS 'org.postgresql.pljava.example.Complex.out' LANGUAGE java
IMMUTABLESTRICT;
CREATE FUNCTION complex_recv(internal) RETURNS complex AS 'org.postgresql.pljava.example.Complext.recv' LANGUAGE
javaIMMUTABLE STRICT;
CREATE FUNCTION complex_send(complex) RETURNS bytea AS 'org.postgresql.pljava.example.Complext.send' LANGUAGE
javaIMMUTABLE STRICT;
CREATE TYPE complex ( internallength = 16, input = complex_in, output = complex_out, receive = complex_recv, send
=complex_send, alignment = double
);