Opened 8 years ago

Closed 8 years ago

#18843 closed Bug (fixed) inspectdb raises TypeError for columns containing '%'

Reported by: Andy Terra Owned by: nobody
Component: Core (Management commands) Version: 1.4
Severity: Normal Keywords: inspectdb, TypeError
Cc: shai@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


python inspectdb --database=foo

class Foobar(models.Model):
TypeError: not enough arguments for format string

I've since inspected the database and spotted fields such as...


...which I believe are causing this error.

Change History (9)

comment:1 Changed 8 years ago by Claude Paroz

Triage Stage: UnreviewedAccepted

I plan to commit first #12460, then it should be easier to fix this one.

comment:2 Changed 8 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In [f5ea730dac0986b2d48889a2d0fab2c5befb4494]:

Fixed #18843 -- Replaced more special chars in column names (inspectdb)

Thanks airstrike for the report.

comment:3 Changed 8 years ago by Claude Paroz

I'm not absolutely sure to have fixed your precise problem. At least, the non-ascii chars stuff is the subject of ticket #16737.

comment:4 Changed 8 years ago by Anssi Kääriäinen

Resolution: fixed
Status: closedreopened

This breaks tests on Oracle. Oracle fails to handle the '%' char in table creation at One possible fix here

This is a quick & dirty fix. There might be some deeper problem in the Oracle backend's handling of table creation query strings, but I am too tired to begin inspecting that possibility.

comment:5 Changed 8 years ago by Claude Paroz

Is there any other special character in Oracle that is accepted in a table name but would be replaced by re.subn(r'\W', '_', new_name)?

comment:6 Changed 8 years ago by EmilStenstrom

Easy pickings: unset

Due to the requirement to test this against multiple databases (one being Oracle) and the fact that an existing patch exists, I'm removing easy_pickings from this one. Please revert if you don't agree.

comment:7 Changed 8 years ago by Shai Berger

Cc: shai@… added

I believe the fix for this problem has already been committed, to master before 1.5 was branched, by @akaariai.

comment:8 Changed 8 years ago by Aymeric Augustin

Anssi recently confirmed that the test suite passes on Oracle (+ Python 3, but that doesn't matter here). So it's probably fixed indeed.

comment:9 Changed 8 years ago by Aymeric Augustin

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.
Back to Top