Opened 5 years ago
Last modified 5 years ago
#31019 closed Bug
The database backend specific checks could be bypassed when using multiple databases with one empty default database. — at Initial Version
Reported by: | Shipeng Feng | Owned by: | nobody |
---|---|---|---|
Component: | Core (System checks) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Here is the settings:
DATABASES = { 'default': {}, 'users': { 'NAME': 'user_data', 'ENGINE': 'django.db.backends.mysql', 'USER': 'mysql_user', 'PASSWORD': 'superS3cret' }, 'customers': { 'NAME': 'customer_data', 'ENGINE': 'django.db.backends.mysql', 'USER': 'mysql_cust', 'PASSWORD': 'veryPriv@ate' } }
Here is the related source code: https://github.com/django/django/blob/f97a6123c07de5099fdf8b7d00ef7d20ed354e07/django/db/models/fields/__init__.py#L340
We only run checks for the first db, and the behavior of the first is undetermined (the first entry of a dictionary),
if the first db is default
, then we would only run dummy backend checks, mysql checks are bypassed.
Note:
See TracTickets
for help on using tickets.