Allow workers to override datallowconn

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Allow workers to override datallowconn
Date: 2018-02-22 18:01:35
Message-ID: CABUevEwWT9ZmonBMRFF0owneoN3DAPgOVzwHAN0bUkxaqY3eNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/>
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>

Attachment Content-Type Size
worker_override_allowconn.c text/x-csrc 8.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-02-22 18:03:13 Re: ERROR: left and right pathkeys do not match in mergejoin
Previous Message Ioseph Kim 2018-02-22 17:47:13 Re: Translations contributions urgently needed