Re: User Defined Types in Java

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: User Defined Types in Java
Дата
Msg-id 20060209123806.GA14852@svana.org
обсуждение исходный текст
Ответ на User Defined Types in Java  (Thomas Hallgren <thomas@tada.se>)
Ответы Re: User Defined Types in Java  (Thomas Hallgren <thomas@tada.se>)
Список pgsql-hackers
On Thu, Feb 09, 2006 at 01:08:01PM +0100, Thomas Hallgren wrote:
> 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

If you look at the code it says in a comment:
               /*                * Only C-coded functions can be I/O functions.  We enforce this                *
restrictionhere mainly to prevent littering the catalogs with                * shell types due to simple typos in
user-definedfunction                * definitions.                */ 
However, you could probably work around this like so:

CREATE FUNCTION dummy(cstring) RETURNS complex AS [random existing
function] LANGUAGE INTERNAL;

This will create the shell type. You then create your other functions
and finally the type, at which point you can delete the dummy function
again.

Roundabout, but it should work (I hope). Note, if you have a validator
on your java code that tries to lookup the return type, you might get
some interesting issues.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Hallgren
Дата:
Сообщение: User Defined Types in Java
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Schema search for default operator classes (was: [ADMIN] Cross schema Primary Key Indexes problem with datatype in the public schema)