Re: pg_config wrongly marked as not parallel safe? - Mailing list pgsql-hackers

From Andres Freund
Subject Re: pg_config wrongly marked as not parallel safe?
Date
Msg-id 20181127000816.yyqyywmlm2qjlk4x@alap3.anarazel.de
Whole thread Raw
In response to Re: pg_config wrongly marked as not parallel safe?  (Joe Conway <mail@joeconway.com>)
Responses Re: pg_config wrongly marked as not parallel safe?  (Joe Conway <mail@joeconway.com>)
Re: pg_config wrongly marked as not parallel safe?  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
On 2018-11-26 19:04:46 -0500, Joe Conway wrote:
> On 11/26/18 6:45 PM, Andres Freund wrote:
> > Hi,
> > 
> > Triggered by the thread at [1] I looked for functions marked as
> > immutable but not parallel safe.
> > 
> > postgres[19492][1]=# SELECT oid::regprocedure, provolatile, proparallel FROM pg_proc WHERE provolatile = 'i' AND
proparallel!= 's';
 
> > ┌─────────────┬─────────────┬─────────────┐
> > │     oid     │ provolatile │ proparallel │
> > ├─────────────┼─────────────┼─────────────┤
> > │ pg_config() │ i           │ r           │
> > └─────────────┴─────────────┴─────────────┘
> > (1 row)
> > 
> > # pg_config
> > { oid => '3400', descr => 'pg_config binary as a function',
> >   proname => 'pg_config', prorows => '23', proretset => 't', proparallel => 'r',
> >   prorettype => 'record', proargtypes => '', proallargtypes => '{text,text}',
> >   proargmodes => '{o,o}', proargnames => '{name,setting}',
> >   prosrc => 'pg_config' },
> > 
> > so that function is marked as immutable but not parallel safe, without
> > an explanation for that odd combination.
> > 
> > Now obviously I don't think it practially matters for pg_config(), but
> > it seems unnecessarily confusing as a general matter.
> > 
> > I think we probably should fix this specific case, and then add a check
> > to opr_sanity.sql or such.
> > 
> > As far as I can tell pg_config() was marked as such since its addition
> > in [2]. Joe, I assume this wasn't intentional?
> 
> Not intentional. Though, sitting here chatting with Stephen about it, I
> am now wondering if pg_config() should actually be marked immutable:
> 
> select * from pg_config() where name = 'VERSION';
>   name   |     setting
> ---------+-----------------
>  VERSION | PostgreSQL 10.5
> (1 row)
> 
> [...upgrade the postgres binaries...]
> 
> select * from pg_config() where name = 'VERSION';
>   name   |     setting
> ---------+-----------------
>  VERSION | PostgreSQL 10.6
> (1 row)
> 
> So the correct answer is probably to mark pg_config() stable, but it
> still seems to be parallel safe to me.

I don't think we should consider immutability to mean anything across
major versions. What'd be helped by doing that? We'd have to rule out
any behaviour change to any immutable function for that to make
sense. Including making an immutable function not immutable anymore.

- Andres


pgsql-hackers by date:

Previous
From: Vik Fearing
Date:
Subject: Re: IMMUTABLE and PARALLEL SAFE function markings
Next
From: Andres Freund
Date:
Subject: Re: IMMUTABLE and PARALLEL SAFE function markings