agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Voillequin, Jean-Marc <Jean-Marc.Voillequin@moodys.com>
Cc: pgsql-sql@lists.postgresql.org <pgsql-sql@lists.postgresql.org>
Subject: Re: parallel safe on user defined functions
Date: Wed, 02 Dec 2020 11:15:35 -0500
Message-ID: <1574257.1606925735@sss.pgh.pa.us> (raw)
In-Reply-To: <DM6PR20MB3329006C838039F0B3F43E64BEF30@DM6PR20MB3329.namprd20.prod.outlook.com>
References: <DM6PR20MB3329006C838039F0B3F43E64BEF30@DM6PR20MB3329.namprd20.prod.outlook.com>

"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





view thread (2+ messages)

Message-ID: <1574257.1606925735@sss.pgh.pa.us>
Permalink:  ../1574257.1606925735@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1574257.1606925735@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Jean-Marc.Voillequin@moodys.com, pgsql-sql@lists.postgresql.org
  Subject: Re: parallel safe on user defined functions
  In-Reply-To: <1574257.1606925735@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox