mirror of
https://github.com/django/django.git
synced 2025-09-10 20:46:52 +00:00
Fixed #29015 -- Added an exception if the PostgreSQL database name is too long.
This commit is contained in:
parent
6d1f576945
commit
6b3d292043
2 changed files with 19 additions and 0 deletions
|
@ -149,6 +149,12 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|||
raise ImproperlyConfigured(
|
||||
"settings.DATABASES is improperly configured. "
|
||||
"Please supply the NAME value.")
|
||||
if len(settings_dict['NAME'] or '') > self.ops.max_name_length():
|
||||
raise ImproperlyConfigured(
|
||||
'Database names longer than %d characters are not supported by '
|
||||
'PostgreSQL. Supply a shorter NAME in settings.DATABASES.'
|
||||
% self.ops.max_name_length()
|
||||
)
|
||||
conn_params = {
|
||||
'database': settings_dict['NAME'] or 'postgres',
|
||||
**settings_dict['OPTIONS'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue