简体   繁体   中英

Call plpgsql Function from a PL/Python Function in PostgreSQL

Is is possible to call a plpgsql function (or any PostgreSQL function ) from a PL/Python function?

So, something like this:

CREATE FUNCTION somefunc() RETURNS void AS $$
DECLARE
    ...
BEGIN
    ...
END;
$$ LANGUAGE plpgsql;

And then use it here

CREATE FUNCTION pythonFunc() RETURNS void AS $$
    ...
    someFunc() #postgreSQL function
    ...
$$ LANGUAGE plpythonu;
create function plpython_function()
returns void as $$

    plpy.execute('select plpgsql_function()')

$$ language plpythonu;

PL/Python Database Access

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM