Opened 8 years ago

Closed 7 years ago

#27533 closed Bug (fixed)

inspectdb crashes on unsupported unique_together constraints in PostgreSQL

Reported by: Wei Ma Owned by: Michael Sinov
Component: Database layer (models, ORM) Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

inspectdb command crashes when I try to generate model classes from postgres db.

the command I used was
python manage.py inspectdb > all_models.py

the error I got was:

File "/xxx/env/lib/python3.5/site-packages/django/core/management/commands/inspectdb.py", line 278, in <genexpr>

tup = '(' + ', '.join("'%s'" % column_to_field_name[c] for c in columns) + ')'

KeyError: None

Change History (8)

comment:1 by Wei Ma, 8 years ago

I created a PR https://github.com/django/django/pull/7618 for this bug.

comment:2 by Max Resnick, 8 years ago

comment:3 by Tim Graham, 8 years ago

Component: Core (Other)Database layer (models, ORM)
Needs tests: set
Summary: inspectdb command crashes when generate model classes from postgres dbinspectdb crashes on unsupported unique_together constraints in PostgreSQL
Triage Stage: UnreviewedAccepted

comment:4 by Wei Ma, 8 years ago

I have closed my PR https://github.com/django/django/pull/7618 due to not able to create test cases. If anyone want to help, please fork my repo and add needed tests.

comment:5 by Michael Sinov, 8 years ago

Needs tests: unset
Owner: changed from nobody to Michael Sinov
Status: newassigned

comment:6 by Mariusz Felisiak, 8 years ago

Has patch: unset
Patch needs improvement: set

comment:7 by Mariusz Felisiak, 8 years ago

Has patch: set

comment:8 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 9aca67be:

Fixed #27533 -- Fixed inspectdb crash if a unique constraint uses an unsupported type.

Note: See TracTickets for help on using tickets.
Back to Top