Changes between Initial Version and Version 3 of Ticket #25476
- Timestamp:
- Sep 27, 2015, 1:14:46 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #25476
- Property Component Uncategorized → Database layer (models, ORM)
- Property Type Uncategorized → Bug
-
Ticket #25476 – Description
initial v3 1 1 Using inspectdb of Django1.8.4 with psycopg2 2.6.1 to import an existing db, get_constraints() attempts to read table constraints. It exits here parsing foreign keys with the traceback: 2 2 3 {{{ 3 4 File "/home/www/db/lib/python3.4/site-packages/django/db/backends/postgresql_psycopg2/introspection.py", line 171, in get_constraints 4 5 "foreign_key": tuple(used_cols[0].split(".", 1)) if kind.lower() == "foreign key" else None, 5 6 IndexError: list index out of range 7 }}} 6 8 7 9 The array of columns returned from the db is populated: 8 10 11 {{{ 9 12 SELECT 10 13 kc.constraint_name, … … 24 27 25 28 ORDER BY kc.ordinal_position ASC; 29 }}} 26 30 31 {{{ 27 32 constraint_name | column_name | constraint_type | array 28 33 … … 35 40 things_pkey | child | PRIMARY KEY | {things.trunk,things.c 36 41 hild} 42 }}} 37 43 38 44 but empty from cursor.fetchall(): for constraint, column, kind, used_cols in cursor.fetchall(). A script using psycopg2 directly does not exhibit this problem. I;ve also tried a current development checkout of django.