Re: [Django] #35394: Warning if `postgres` database has been renamed (e.g. DigitalOcean managed) (was: Warning if `postgres` database has been rename (e.g. DigitalOcean managed))

瀏覽次數:3 次
跳到第一則未讀訊息

Django

未讀,
2024年4月22日 晚上10:33:054月22日
收件者:django-...@googlegroups.com
#35394: Warning if `postgres` database has been renamed (e.g. DigitalOcean managed)
-------------------------------------+-------------------------------------
Reporter: Jeffry Babb | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: postgres default db | Triage Stage:
name | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* summary:
Warning if `postgres` database has been rename (e.g. DigitalOcean
managed)
=>
Warning if `postgres` database has been renamed (e.g. DigitalOcean
managed)

Comment:

The postgres database being named differently on Heroku was the impetus
for adding the fallback and the warning (#24791). Making the name of the
defaultdb configurable was [https://groups.google.com/g/django-
developers/c/ymdT05CaPF0/m/Vov9hzMOrvYJ proposed as a possible solution]
but there weren't any arguments for or against. The fallback solution
makes things easy for the user, although the warning is mildly annoying
and hardcoding 'postgres' leaves no way to configure things safely.
[https://github.com/django/django/blob/bcad5ad92b1dad2874453dee7a480e9b9f29aad5/django/db/backends/base/base.py#L708
The docstring] of`BaseDatabaseWrapper._nodb_cursor()` explains possible
dangers of the current fallback approach.

I can't think of a better way to make this configurable than to add a new
option in `DATABASES` like `DEFAULT_DB`, although it appears only
applicable on PostgreSQL. I'm not sure if it's worth it. I would continue
the discussion on the mailing list.
--
Ticket URL: <https://code.djangoproject.com/ticket/35394#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
回覆所有人
回覆作者
轉寄
0 則新訊息