But this doesn't seem to actually be documented anywhere, so it's unclear
whether this is actually a supported feature or just an implementation
artifact.
If this really is supported, then it should be documented - presumably in
[https://docs.djangoproject.com/en/5.0/ref/databases/#postgresql-notes
PostgreSQL notes].
--
Ticket URL: <https://code.djangoproject.com/ticket/35016>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
This vary depending on your database backend (as
[https://docs.djangoproject.com/en/dev/ref/settings/#std-setting-OPTIONS
documented]), but I agree that it's worth mentioning that the PostgreSQL
backend passes the content of OPTIONS as keyword arguments to the
connection constructor, allowing for more advanced control of driver
behavior.
Would you like to prepare a patch?
--
Ticket URL: <https://code.djangoproject.com/ticket/35016#comment:1>
Comment (by Yashas Donthi):
I'd like to prepare a patch
--
Ticket URL: <https://code.djangoproject.com/ticket/35016#comment:2>
* owner: nobody => Yashas Donthi
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/35016#comment:3>
* has_patch: 0 => 1
Old description:
> As far as I can see, when a database uses the
> `django.db.backends.postgresql` engine, any options from the `OPTIONS`
> key that are not recognized by the engine itself are passed directly to
> the underlying libpq library. This way you can set options like
> [https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-
> CONNECT-SSLMODE `sslmode`].
>
> But this doesn't seem to actually be documented anywhere, so it's unclear
> whether this is actually a supported feature or just an implementation
> artifact.
>
> If this really is supported, then it should be documented - presumably in
> [https://docs.djangoproject.com/en/5.0/ref/databases/#postgresql-notes
> PostgreSQL notes].
New description:
As far as I can see, when a database uses the
`django.db.backends.postgresql` engine, any options from the `OPTIONS` key
that are not recognized by the engine itself are passed directly to the
underlying libpq library. This way you can set options like
[https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-
SSLMODE `sslmode`].
But this doesn't seem to actually be documented anywhere, so it's unclear
whether this is actually a supported feature or just an implementation
artifact.
If this really is supported, then it should be documented - presumably in
[https://docs.djangoproject.com/en/5.0/ref/databases/#postgresql-notes
PostgreSQL notes].
PR #17586 to fix this: https://github.com/django/django/pull/17586
--
--
Ticket URL: <https://code.djangoproject.com/ticket/35016#comment:4>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/35016#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"eeb2119985d9879b1d9ac3730ea0b53c0c019221" eeb21199]:
{{{
#!CommitTicketReference repository=""
revision="eeb2119985d9879b1d9ac3730ea0b53c0c019221"
Fixed #35016 -- Doc'd that DATABASES["OPTIONS"] are passed to new
PostgreSQL connections.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35016#comment:6>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"6c992dc0031f9f3134aa50d1bc00b1eee581ae13" 6c992dc0]:
{{{
#!CommitTicketReference repository=""
revision="6c992dc0031f9f3134aa50d1bc00b1eee581ae13"
[5.0.x] Fixed #35016 -- Doc'd that DATABASES["OPTIONS"] are passed to new
PostgreSQL connections.
Backport of eeb2119985d9879b1d9ac3730ea0b53c0c019221 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35016#comment:7>