[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    [GENERAL] include source file from another language into function body?
From:       Steve White <swhite () aip ! de>
Date:       2011-01-31 16:09:08
Message-ID: 20110131160908.GA19988 () cashmere ! aip ! de
[Download RAW message or body]

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
| -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic