Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#6710 closed (fixed)

DATABASE_OPTIONS ignored for postgresql_psycopg2

Reported by: Robert Coup Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: postgres
Cc: benjamin.slavin@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Psycopg2 only looks in the kwargs passed to psycopg2.connect() if there is no dsn string. In django this means everything set in settings.DATABASE_OPTIONS is happily ignored (eg. sslmode) because _cursor() builds a dsn string.

The attached patch makes all the db params into a dictionary passed via kwargs instead.

Attachments (1)

psycopg2_connection_params.diff (1.7 KB ) - added by Robert Coup 17 years ago.

Download all attachments as: .zip

Change History (7)

by Robert Coup, 17 years ago

comment:1 by Robert Coup, 17 years ago

Link to the relevant code in psycopg2.

Testing for sslmode is actually quite nasty:

  1. in postgresql.conf set:
    • log_min_messages=debug5
    • log_min_error_statement=debug5
  2. reload PG
  3. set DATABASE_OPTIONS['sslmode'] to one of the sslmode settings.
  4. look in your PG log for the absence/presence of a line like:
    2008-03-02 15:23:49 NZDT 850 DEBUG:  SSL connection from "(anonymous)"
    

comment:2 by Marc Fargas, 17 years ago

Triage Stage: UnreviewedAccepted

help(psycopg2.connect) says it all.

comment:3 by Joey Wilhelm, 16 years ago

Are there any plans to integrate this patch? I prefer to use direct releases/checkouts whenever possible, without having to apply patches and this is pretty much a blocker bug for me at the moment.

comment:4 by Ben Slavin, 16 years ago

Cc: benjamin.slavin@… added

comment:5 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [9981]) Fixed #6710 -- Made DATABASE_OPTIONS work with postgresql_psycopg2 backend.

Thanks to rcoup for the patch.

comment:6 by Malcolm Tredinnick, 16 years ago

(In [9982]) [1.0.X] Fixed #6710 -- Made DATABASE_OPTIONS work with postgresql_psycopg2 backend.

Thanks to rcoup for the patch.

Backport of r9981 from trunk.

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