Re: Call postgres PL/Python stored function from another PL/Python block.

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: lodopidolo <dir(dot)postgresql(at)orencio(dot)org>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Call postgres PL/Python stored function from another PL/Python block.
Date: 2016-01-13 17:00:50
Message-ID: 569682C2.9000202@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Grelaud 2016-01-13 17:18:08 Re: Why PG uses nested-loop join when no indexes are available?
Previous Message Jeff Janes 2016-01-13 16:51:15 Re: Blocked updates and background writer performance