Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#9991 closed (fixed)

manage.py inspectdb guesses TextField on postgres' real column

Reported by: Adys Owned by: peterbe
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)

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 peterbe 5 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 5 years ago by ramiro

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

(edited description)

comment:2 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by russellm

  • Component changed from Uncategorized to django-admin.py inspectdb

comment:4 Changed 5 years ago by peterbe

  • Owner changed from nobody to peterbe
  • Status changed from new to assigned

I'm happy to write a patch

Changed 5 years ago by peterbe

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

comment:5 Changed 5 years ago by peterbe

  • Resolution set to fixed
  • Status changed from assigned to closed

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 5 years ago by ramiro

  • Resolution fixed deleted
  • Status changed from closed to reopened

Restoring ticket status

comment:7 Changed 5 years ago by jacob

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:8 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.