Changes between Initial Version and Version 3 of Ticket #25476


Ignore:
Timestamp:
Sep 27, 2015, 1:14:46 PM (9 years ago)
Author:
Claude Paroz
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25476

    • Property Component UncategorizedDatabase layer (models, ORM)
    • Property Type UncategorizedBug
  • Ticket #25476 – Description

    initial v3  
    11Using 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:
    22
     3{{{
    34File "/home/www/db/lib/python3.4/site-packages/django/db/backends/postgresql_psycopg2/introspection.py", line 171, in get_constraints
    45"foreign_key": tuple(used_cols[0].split(".", 1)) if kind.lower() == "foreign key" else None,
    56IndexError: list index out of range
     7}}}
    68
    79The array of columns returned from the db is populated:
    810
     11{{{
    912SELECT
    1013kc.constraint_name,
     
    2427
    2528ORDER BY kc.ordinal_position ASC;
     29}}}
    2630
     31{{{
    2732constraint_name     | column_name | constraint_type |                array
    2833
     
    3540things_pkey | child | PRIMARY KEY | {things.trunk,things.c
    3641hild}
     42}}}
    3743
    3844but 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.
Back to Top