Re: IMMUTABLE and PARALLEL SAFE function markings

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, Gajus Kuizinas <gajus(at)gajus(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: IMMUTABLE and PARALLEL SAFE function markings
Date: 2018-11-27 00:40:13
Message-ID: 29696.1543279213@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com> writes:
> On 27/11/2018 01:13, Stephen Frost wrote:
>> Parallel safe functions should be marked as such. Immutable functions
>> should be marked as such. We should not assume that one implies the
>> other, nor should we operate as if they do.

> Yes we should! Unless you can produce a case where an immutable
> function is not parallel safe.

As far as that goes, I agree with the idea of adding an oprsanity test
that shows any built-in functions that are immutable but not parallel
safe, on the grounds Stephen mentioned: it's probably a mistake, and
if it isn't, we can add that function to the expected output.

I'm way less inclined to buy into the idea that it MUST be wrong, though.
Immutability is a promise about result stability and lack of side effects,
but it is not a promise about implementation details. There could be an
implementation reason not to run something in a parallel worker. Off the
top of my head, a possible example is "it's written in plfoo which hasn't
yet been made to work correctly in parallel workers".

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-11-27 00:43:17 Re: pg_config wrongly marked as not parallel safe?
Previous Message Stephen Frost 2018-11-27 00:39:18 Re: IMMUTABLE and PARALLEL SAFE function markings