include source file from another language into function body?

From: Steve White <swhite(at)aip(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: include source file from another language into function body?
Date: 2011-01-31 16:09:08
Message-ID: 20110131160908.GA19988@cashmere.aip.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Is there an accepted way to load code in another language into a PostgreSQL
function body?

This would be really nice in several ways, for example: to run a code
checker outside of postgresql, and to make things easier for source code
colorizers.

I have in mind something like

================================================
CREATE OR REPLACE FUNCTION
myfunc( arg1 TEXT, arg2 INTEGER )
RETURNS VOID AS 'Conversion.py' LANGUAGE PLPYTHONU;
================================================

But when I try the above, on running the function I get an error
"could not compile...", which isn't surpising...

For C functions, there is a special form of CREATE FUNCTION ... AS that
causes an object file to be read...

(In the case of Python, one could achieve something like this effect
by using the execfile() function. However as I understand it, this would
happen at run time...)

Thanks!

--
| - - - - - - - - - - - - - - - - - - - - - - - - -
| Steve White +49(331)7499-202
| E-Science Zi. 27 Villa Turbulenz
| - - - - - - - - - - - - - - - - - - - - - - - - -
| Astrophysikalisches Institut Potsdam (AIP)
| An der Sternwarte 16, D-14482 Potsdam
|
| Vorstand: Prof. Dr. Matthias Steinmetz, Peter A. Stolz
|
| Stiftung privaten Rechts, Stiftungsverzeichnis Brandenburg: III/7-71-026
| - - - - - - - - - - - - - - - - - - - - - - - - -

Browse pgsql-general by date

  From Date Subject
Next Message Jerry LeVan 2011-01-31 16:09:20 Create Table Question...
Previous Message Bryan Murphy 2011-01-31 15:55:43 Hit by the out of memory killer last night