Re: Call postgres PL/Python stored function from another PL/Python block. - Mailing list pgsql-general

From Jim Nasby
Subject Re: Call postgres PL/Python stored function from another PL/Python block.
Date
Msg-id 569682C2.9000202@BlueTreble.com
Whole thread Raw
In response to Call postgres PL/Python stored function from another PL/Python block.  (lodopidolo <dir.postgresql@orencio.org>)
List pgsql-general
On 1/13/16 9:47 AM, lodopidolo wrote:
> Hello. It is possible to call al PL/Python stored function natively from
> another PL/Python function?

Stackoverflow is stupid and won't let me post there, but here's what you
want:

There is no special capability to call other plpython functions. You
need to call them as you would any other Postgres function, ie:

     do $$
     begin
     ...
     rv = plpy.execute("SELECT f1()")
     t = rv[1]["f1]
     ...
     end;
     $$ language 'plpython3u';

See
http://www.postgresql.org/docs/9.5/static/plpython-database.html#AEN65599 for
more information.

--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com


pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Blocked updates and background writer performance
Next
From: David Grelaud
Date:
Subject: Re: Why PG uses nested-loop join when no indexes are available?