#34200: Allow setting postgres role during connection setup -------------------------------------+------------------------------------- Reporter: Mike Crute | Owner: Mike | Crute Type: New feature | Status: new Component: Database layer | Version: 4.1 (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak): Replying to [comment:5 Mike Crute]: > > Also, is it not already possible to `SET ROLE` in `DATABASE["OPTIONS"]`? (see [https://docs.djangoproject.com/en/stable/ref/settings/#std-setting- OPTIONS docs]) > > Perhaps I'm missing something but I do not see how this is possible in the current settings. The connection setup logic must execute `SET ROLE <role>` against a cursor to set the role. It's not a client option that can just be passed through as far as I'm aware. It's possible to set e.g. `search_path` via `DATABASE["OPTIONS"]`: {{{ DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", "OPTIONS": { "options": "-c search_path=custom_path", }, }, }}} Is it not possible to set `ROLE` in the same way? {{{ DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", "OPTIONS": { "options": "-c role=custom_role", }, }, }}} -- Ticket URL: <https://code.djangoproject.com/ticket/34200#comment:8> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/01070184e63a9060-d45d4593-48c0-48a6-aad0-e1c81d35ddab-000000%40eu-central-1.amazonses.com.