Opened 9 years ago

Closed 4 years ago

#6744 closed Bug (fixed)

inspectdb doesn't set the primary_key/unique attribute on mixed case columns

Reported by: Fabio Corneti Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Normal Keywords: inspectdb
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I'm trying to use inspectdb with a legacy table like this in a MySQL db:

+---------------+--------------+------+-----+---------+----------------+
| Field         | Type         | Null | Key | Default | Extra          |
+---------------+--------------+------+-----+---------+----------------+
| idAnagrafica  | int(11)      | NO   | PRI | NULL    | auto_increment | 
| descrizione   | varchar(254) | YES  |     | NULL    |                | 

By default "idAnagrafica" is imported as "idanagrafica" in the resulting model, but it's not designated as the primary key because of the lookup on the schema dictionary is done using the lowercase attribute name.
The attached patch solves the issue for MySQL 5.0.

Attachments (1)

mixedcase_column_attributes.diff (693 bytes) - added by Fabio Corneti 9 years ago.

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by Fabio Corneti

comment:1 Changed 9 years ago by Jacob

Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by Gabriel Hurley

Component: django-admin.py inspectdbCore (Management commands)

comment:3 Changed 6 years ago by Julien Phalip

Severity: Normal
Type: Bug

comment:4 Changed 5 years ago by Ramiro Morales

Easy pickings: unset
Keywords: inspectdb added
UI/UX: unset

comment:5 Changed 4 years ago by Claude Paroz

Resolution: fixed
Status: newclosed

AFAIK this is fixed for some time already.

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