Re: parallel safe on user defined functions - Mailing list pgsql-sql

From Tom Lane
Subject Re: parallel safe on user defined functions
Date
Msg-id 1574257.1606925735@sss.pgh.pa.us
Whole thread Raw
In response to parallel safe on user defined functions  ("Voillequin, Jean-Marc" <Jean-Marc.Voillequin@moodys.com>)
List pgsql-sql
"Voillequin, Jean-Marc" <Jean-Marc.Voillequin@moodys.com> writes:
> For instance, is the following plpython3u function parallel safe?

> create or replace function f1(key text, val_default in text default null) returns text as $$
> return GD.get(key.lower(),val_default)
> $$ language plpython3u;

No.  There's no mechanism for sharing Python interpreter state across
processes.

> => Is it a transaction state change?

Throwing an error is always OK (we could hardly decree otherwise).

>                 execute format('select (''%s''::date + interval ''%s'')::date',d,concat(n,' day')) into ret;

> => Is this execute statement be considered as a cursor?

No, it's just a weird way of spelling a variable assignment.

            regards, tom lane



pgsql-sql by date:

Previous
From: "Voillequin, Jean-Marc"
Date:
Subject: parallel safe on user defined functions
Next
From: Yambu
Date:
Subject: calling function