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

From Joe Conway
Subject Re: pg_config wrongly marked as not parallel safe?
Date
Msg-id 09948564-cf4b-c9fa-d2ca-c912c3d15985@joeconway.com
Whole thread Raw
In response to pg_config wrongly marked as not parallel safe?  (Andres Freund <andres@anarazel.de>)
Responses Re: pg_config wrongly marked as not parallel safe?
List pgsql-hackers
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.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: [PATCH] Tiny CREATE STATISTICS tab-completion cleanup
Next
From: Stephen Frost
Date:
Subject: Re: IMMUTABLE and PARALLEL SAFE function markings