diff options
author | priyanshsaxena <geniuspriyansh@gmail.com> | 2018-01-18 23:45:16 +0530 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-04-27 21:37:42 -0400 |
commit | 6b3d2920438746d260f7d158a91db53450055ae2 (patch) | |
tree | d38a35b9793763e06e48394d5421828b20d2ed95 /django/db/backends/postgresql/base.py | |
parent | 6d1f5769455ad8e1384087b92aa5839c3540d9ba (diff) | |
download | django-6b3d2920438746d260f7d158a91db53450055ae2.tar.gz |
Fixed #29015 -- Added an exception if the PostgreSQL database name is too long.
Diffstat (limited to 'django/db/backends/postgresql/base.py')
-rw-r--r-- | django/db/backends/postgresql/base.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 3537270897..025981c1e5 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -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'], |