Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#35016 closed Cleanup/optimization (fixed)

Missing documentation for setting libpq options with the PostgreSQL backend

Reported by: Roman Donchenko Owned by: Yashas Donthi
Component: Documentation Version: 5.0
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Yashas Donthi)

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 `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 PostgreSQL notes.

PR #17586 to fix this: https://github.com/django/django/pull/17586

Change History (7)

comment:1 by Mariusz Felisiak, 9 months ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

This vary depending on your database backend (as 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?

comment:2 by Yashas Donthi, 9 months ago

I'd like to prepare a patch

comment:3 by Yashas Donthi, 9 months ago

Owner: changed from nobody to Yashas Donthi
Status: newassigned

comment:4 by Yashas Donthi, 9 months ago

Description: modified (diff)
Has patch: set

comment:5 by Mariusz Felisiak, 9 months ago

Triage Stage: AcceptedReady for checkin

comment:6 by Mariusz Felisiak <felisiak.mariusz@…>, 9 months ago

Resolution: fixed
Status: assignedclosed

In eeb21199:

Fixed #35016 -- Doc'd that DATABASESOPTIONS are passed to new PostgreSQL connections.

comment:7 by Mariusz Felisiak <felisiak.mariusz@…>, 9 months ago

In 6c992dc0:

[5.0.x] Fixed #35016 -- Doc'd that DATABASESOPTIONS are passed to new PostgreSQL connections.

Backport of eeb2119985d9879b1d9ac3730ea0b53c0c019221 from main

Note: See TracTickets for help on using tickets.
Back to Top