diff options
author | Tom Carrick <tom@carrick.eu> | 2020-07-18 13:17:39 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-09-21 18:24:56 +0200 |
commit | e387f191f76777015b6ea687ce83cdb05ee47cee (patch) | |
tree | 003d83b5efda40fbfcdc1aa9302faca9578b1e30 /django/db/backends/postgresql/introspection.py | |
parent | ba6b32e5efc4c813ba4432777b3b1743d4205d14 (diff) | |
download | django-e387f191f76777015b6ea687ce83cdb05ee47cee.tar.gz |
Fixed #31777 -- Added support for database collations to Char/TextFields.
Thanks Simon Charette and Mariusz Felisiak for reviews.
Diffstat (limited to 'django/db/backends/postgresql/introspection.py')
-rw-r--r-- | django/db/backends/postgresql/introspection.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py index b7952eaed7..a0e49c8da7 100644 --- a/django/db/backends/postgresql/introspection.py +++ b/django/db/backends/postgresql/introspection.py @@ -69,9 +69,11 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): SELECT a.attname AS column_name, NOT (a.attnotnull OR (t.typtype = 'd' AND t.typnotnull)) AS is_nullable, - pg_get_expr(ad.adbin, ad.adrelid) AS column_default + pg_get_expr(ad.adbin, ad.adrelid) AS column_default, + CASE WHEN collname = 'default' THEN NULL ELSE collname END AS collation FROM pg_attribute a LEFT JOIN pg_attrdef ad ON a.attrelid = ad.adrelid AND a.attnum = ad.adnum + LEFT JOIN pg_collation co ON a.attcollation = co.oid JOIN pg_type t ON a.atttypid = t.oid JOIN pg_class c ON a.attrelid = c.oid JOIN pg_namespace n ON c.relnamespace = n.oid |