Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#12729 closed (fixed)

contrib.auth on seperate db in multi-db setup fails

Reported by: dhageman Owned by: nobody
Component: contrib.auth Version: master
Severity: Keywords: multi-db
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


contrib.auth will break if you put it onto a database by itself. There is a hard coded SQL statement in contrib.auth.backends at line 27 (get_group_permissions) that joins the auth tables with django_content_type. This will obviously cause an error if the django_ tables are not in the same database with the auth_ tables.

Change History (4)

comment:1 Changed 9 years ago by dhageman

Version: 1.1SVN

comment:2 Changed 9 years ago by Jacob

milestone: 1.2
Triage Stage: UnreviewedAccepted

We're probably not going to tackle the "django_* tables on a different db from the auth_* tables" this time around. That requires figuring out foreign keys across databases, which probably is never going to work (think constraints), and hence is the topic of a *much* bigger problem.

For the purposes of this ticket, let's just tackle the fact that the ModelBackend hardcodes the default connection.

comment:3 Changed 9 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [12509]) Fixed #12729 -- Replaced a hard-coded SQL statement with an ORM query so that the contrib.auth ModelBackend will work on a routed multi-db setup. Thanks to dhageman for the report.

Historical note: The SQL that was removed predates Django being open sourced.

comment:4 Changed 7 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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