Re: IMMUTABLE and PARALLEL SAFE function markings

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, gajus(at)gajus(dot)com, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: IMMUTABLE and PARALLEL SAFE function markings
Date: 2018-11-27 04:21:42
Message-ID: 5704.1543292502@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Nov 26, 2018 at 8:49 PM Andrew Gierth
> <andrew(at)tao11(dot)riddles(dot)org(dot)uk> wrote:
>> I'm a bit more concerned by the fact that inlining the function isn't
>> affecting the parallel safety of the query - the fact that parallel
>> safety is being checked prior to inlining means that if inlining
>> *introduces* a parallel hazard, it will go unnoticed?

> If a function is marked parallel-safe but internally calls
> parallel-restricted or parallel-unsafe functions, it wasn't really
> parallel-safe in the first place. So I think that if inlining
> introduces a parallel hazard, the user has mislabeled some functions
> and any resulting injury is self-inflicted.

Hm. We intentionally allow SQL functions to be marked as less mutable
than their internals, because sometimes that's useful for tricking
the planner. However, IIRC we don't inline when we see that's the
case. Maybe there needs to be a similar restriction for parallelism
markings.

Alternatively, could we postpone the parallelism checks till after
function inlining? Do we even make any before that?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-11-27 04:26:32 Re: IMMUTABLE and PARALLEL SAFE function markings
Previous Message Andrew Gierth 2018-11-27 04:20:24 Re: IMMUTABLE and PARALLEL SAFE function markings