include source file from another language into function body? - Mailing list pgsql-general

From Steve White
Subject include source file from another language into function body?
Date
Msg-id 20110131160908.GA19988@cashmere.aip.de
Whole thread Raw
List 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
| -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Update existing system explicit cast to make it implicit
Next
From: Jerry LeVan
Date:
Subject: Create Table Question...