Re: Allow workers to override datallowconn - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: Allow workers to override datallowconn
Date
Msg-id CABUevExVUZMvQwjMEeX+ZUC1O3ZOjUp71irCCP7XhMEe=puxVg@mail.gmail.com
Whole thread Raw
In response to Re: Allow workers to override datallowconn  (Andres Freund <andres@anarazel.de>)
Responses Re: Allow workers to override datallowconn  (Andres Freund <andres@anarazel.de>)
Re: Allow workers to override datallowconn  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, Feb 22, 2018 at 8:26 PM, Andres Freund <andres@anarazel.de> wrote:
Hi,

On 2018-02-22 20:24:03 +0100, Magnus Hagander wrote:
> In a background worker you can just set the parameter using
> SetConfigOption(), no? That seems a lot easier than turning things in to a
> kv pair and back...

Sure, but, it doesn't seem bad to offer the option to only allow this
for code running as superuser.
 
> I can see the point for having such a parameter for pg_upgrade, but I'm not
> sure we'd necessarily want to overload them.

What's the argument against?

Complexity for the bgw usecase. It now has to construct a key/value pair with proper escaping (well, for this one flag it would be easy, but if we do that wouldn't we also support the other config params? Were you thinking we'd have *just* tihs one?). Basically taking a data that you have in a "structured format"  in the btw already turning it to a string and then parsing it back into structured data in the same string.

I think it'd be cleaner to let the bgw initializer pass those as flags. A "user connection" parameter could still use the booelan in InitPostgres() of course, and not invent a new things there, but the entry point API could stay simpler.

I haven't actually looked into what it would look like, so it could be that I'm overestimating what it'd mean of course.


--

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Allow workers to override datallowconn
Next
From: Magnus Hagander
Date:
Subject: Re: Online enabling of checksums