Re: Pl/Java and GCJ

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Thomas Hallgren <thhal(at)mailblocks(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Pl/Java and GCJ
Date: 2004-04-27 03:38:32
Message-ID: 200404270338.i3R3cW927093@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Hallgren wrote:
> Hi,
> I've made some very encouraging tests using The GNU version of Java known as
> GCJ together with my Pl/Java implementation . At present I use GCJ just like
> any other JVM, i.e. as an interpreter. This is not very optimal since GCJ
> can compile all Java code into shared libraries just like it would compile C
> or C++ code.
>
> Putting it short, there's a tradeoff between adhering to the proposed
> standard for SQL/Java mapping and using precompiled shared objects.
> Pre-loaded modules loaded by the postmaster for instance, can never be
> standard although it will help boost performance a great deal.
>
> I guess that extending the proposed functionality is OK as long as attempts
> are made to follow the standard whenever possible. To do this, I'd like some
> advice concerning loading of shared libraries that are the result of a jar
> file gcj compilation.
>
> Today, using a "normal" JVM, I can install modules in the form of jar files
> into the database. The modules can then be used dynamically and on demand by
> Pl/Java. Using GCJ, I'd like to have the same semantics from a user
> perspective (since they are modelled from the standard proposal) but behind
> the scene the jar file should be compiled into a shared library which then
> is made available to postgres. Question is, where do I store the shared
> object, and how do I load it? Ideally, I'd like it to be stored in the
> database and subject to normal grant/revoke rights etc. but dlopen() will
> hardly look there. So instead, I'd like to store it somewhere in the
> filesystem on the server where postmaster runs.
>
> Is PostgreSQL doing something similar in other places today (i.e. install a
> shared library on the server using SQL commands issued from the client)? Any
> thoughts and/or ideas on this are greatly appreciated.

It seems this would be handled just like we handle C functions today,
that is you create a shared object file, it sits in the file system, and
you LOAD the object into your backend, or you record it via CREATE
FUNCTION and specify the pathname.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message wespvp 2004-04-27 04:00:02 Re: thread_test.c problems
Previous Message Bruce Momjian 2004-04-27 03:34:17 Re: Reporting a security hole