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

From: lodopidolo <dir(dot)postgresql(at)orencio(dot)org>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Call postgres PL/Python stored function from another PL/Python block.
Date: 2016-01-13 19:46:26
Message-ID: CAH8CjoDda0+1UU2n=Ghhgy9sxU+W1YVsijgTaBnSpvmVurr1UQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ok, thank you very much.

2016-01-13 19:04 GMT+01:00 Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>:

> On 01/13/2016 07:47 AM, lodopidolo wrote:
>
>> Hello. It is possible to call al PL/Python stored function natively from
>> another PL/Python function?
>>
>> Something like:
>>
>> |createorreplace functionf1()returns text as$$return"hello"$$language
>> 'plpython3u';|
>>
>> |do $$begin...t =f1()...end;$$language 'plpython3u';|
>>
>>
>> Regards.
>>
>> (this question has been made in
>>
>> http://stackoverflow.com/questions/34764665/call-postgres-pl-python-stored-function-from-another-pl-python-block
>> too).
>>
>
> In addition to the other answers there is the option of just creating the
> function in a Python module outside Postgres and doing:
>
> from some_module import f
>
> Which would seem to address this(from the SO post):
>
> "This can be done using t = plpy.execute("select f1()"), but I want, if it
> is possible, call it as a normal Python function to avoid type conversions
> (for example jsonb, etc)."
>
> The downside being you have a dependency outside the database.
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-01-13 20:10:15 Re: pg_dump problem with dropped NOT NULL on child table
Previous Message Karsten Hilbert 2016-01-13 19:38:31 pg_dump problem with dropped NOT NULL on child table