Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#9991 closed (fixed)

manage.py inspectdb guesses TextField on postgres' real column

Reported by: Jerome Leclanche Owned by: Peter Bengtsson
Component: django-admin.py inspectdb Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Ramiro Morales)

Using python manage.py inspectdb outputs a models.TextField type as guess for every 'real' (float4) column when using postgresql (psycopg2). Example:

    modifier_float = models.TextField() # This field type is a guess.

Quick fix: Append "700: 'FloatField'" to postgres' introspection.py's data_types_reverse dict. SVN is acting weird and I don't really know django's underlying codebase, so I rather let someone else patch this (or explain why it's intended).

Attachments (1)

9991.patch (477 bytes) - added by Peter Bengtsson 8 years ago.
The patch. Only tested this manually. Working on how to write tests for this.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 8 years ago by Ramiro Morales

Description: modified (diff)

(edited description)

comment:2 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Russell Keith-Magee

Component: Uncategorizeddjango-admin.py inspectdb

comment:4 Changed 8 years ago by Peter Bengtsson

Owner: changed from nobody to Peter Bengtsson
Status: newassigned

I'm happy to write a patch

Changed 8 years ago by Peter Bengtsson

Attachment: 9991.patch added

The patch. Only tested this manually. Working on how to write tests for this.

comment:5 Changed 8 years ago by Peter Bengtsson

Resolution: fixed
Status: assignedclosed

There are no tests for any management commands. Feel way to junior in this codebase to know how to start adding these kind of tests since they're non-trivial.
Happy to help if someone more senior can get me started.

comment:6 Changed 8 years ago by Ramiro Morales

Resolution: fixed
Status: closedreopened

Restoring ticket status

comment:7 Changed 8 years ago by Jacob

Resolution: fixed
Status: reopenedclosed

(In [10380]) [1.0.X] Fixed #9991: correctly introspect PostgreSQL 'real' types. Backport of r10379 from trunk.

comment:8 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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