Allow workers to override datallowconn - Mailing list pgsql-hackers

From Magnus Hagander
Subject Allow workers to override datallowconn
Date
Msg-id CABUevEwWT9ZmonBMRFF0owneoN3DAPgOVzwHAN0bUkxaqY3eNQ@mail.gmail.com
Whole thread Raw
Responses Re: Allow workers to override datallowconn  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Allow workers to override datallowconn  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
In working on the checksumhelper patch, we came across wanting a background worker to be allowed to bypass datallowconn for a database. Right now we didn't take care of that, and just said "you have to ALTER TABLE" first.

Specifically for this usecase that is OK, but not paticularly user friendly. And I think this is a use that can also be useful for other things.

Attached is a patch that adds new Override versions of the functions to connect to a database from a background worker.

Another option would be to just add the parameter directly to the regular connection function, and not create separate functions. But that would make it an incompatible change. And since background workers are commonly used in extensions, that would break a lot of extensions out there. I figured it's probably not worth doing that, and thus added the new functions. What do others think about that?

Are there any other caveats in doing that this actually makes it dangerous to just allow bypassing it for extensions?

--
Attachment

pgsql-hackers by date:

Previous
From: Ioseph Kim
Date:
Subject: Re: Translations contributions urgently needed
Next
From: Tom Lane
Date:
Subject: Re: ERROR: left and right pathkeys do not match in mergejoin