Opened 17 years ago

Closed 12 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: dev
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 17 years ago.

Download all attachments as: .zip

Change History (6)

by Fabio Corneti, 17 years ago

comment:1 by Jacob, 17 years ago

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

comment:2 by Gabriel Hurley, 14 years ago

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

comment:3 by Julien Phalip, 14 years ago

Severity: Normal
Type: Bug

comment:4 by Ramiro Morales, 13 years ago

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

comment:5 by Claude Paroz, 12 years ago

Resolution: fixed
Status: newclosed

AFAIK this is fixed for some time already.

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