Re: pg_config wrongly marked as not parallel safe?

From: Joe Conway <mail(at)joeconway(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_config wrongly marked as not parallel safe?
Date: 2018-11-27 00:04:46
Message-ID: 09948564-cf4b-c9fa-d2ca-c912c3d15985@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2018-11-27 00:05:02 Re: IMMUTABLE and PARALLEL SAFE function markings
Previous Message Tomas Vondra 2018-11-26 23:55:35 Re: [PATCH] Tiny CREATE STATISTICS tab-completion cleanup