diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py
index 24bd45c..9a1c28f 100644
a
|
b
|
class DatabaseIntrospection(BaseDatabaseIntrospection):
|
207 | 207 | WHEN idx.indexprs IS NOT NULL THEN |
208 | 208 | pg_get_indexdef(idx.indexrelid) |
209 | 209 | END AS exprdef, |
210 | | CASE |
211 | | WHEN am.amcanorder THEN |
212 | | CASE (option & 1) |
213 | | WHEN 1 THEN 'DESC' ELSE 'ASC' |
214 | | END |
| 210 | CASE am.amname WHEN 'btree' THEN |
| 211 | CASE i.indoption[(i.keys).n - 1] & 1 |
| 212 | WHEN 1 THEN 'DESC' ELSE 'ASC' |
| 213 | END |
| 214 | ELSE NULL |
215 | 215 | END as ordering |
216 | 216 | FROM ( |
217 | 217 | SELECT |
… |
… |
class DatabaseIntrospection(BaseDatabaseIntrospection):
|
222 | 222 | LEFT JOIN pg_class c2 ON idx.indexrelid = c2.oid |
223 | 223 | LEFT JOIN pg_am am ON c2.relam = am.oid |
224 | 224 | LEFT JOIN pg_attribute attr ON attr.attrelid = c.oid AND attr.attnum = idx.key |
| 225 | LEFT JOIN (SELECT i.indexrelid, i.indrelid, i.indoption, |
| 226 | i.indisunique, i.indisclustered, i.indpred, |
| 227 | i.indexprs, |
| 228 | information_schema._pg_expandarray(i.indkey) AS keys |
| 229 | FROM pg_catalog.pg_index i) i ON (c2.oid = i.indrelid) |
225 | 230 | WHERE c.relname = %s |
226 | 231 | ) s2 |
227 | 232 | GROUP BY indexname, indisunique, indisprimary, amname, exprdef; |