Opened 15 years ago

Closed 15 years ago

#10062 closed (wontfix)

inspectdb could use random field to inspect table

Reported by: Phoebe Bright Owned by: nobody
Component: django-admin.py inspectdb Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently uses the first record SELECT * FROM %s LIMIT 1
If there is bad data in the first record it can fail
eg. Warning: Incorrect datetime value: '11437866' for function str_to_time
I know this is really a problem with the database and could potentially be confusing and slow - but how about picking a random record.

SELECT * FROM %s ORDER BY RAND() LIMIT 1

Change History (1)

comment:1 by Malcolm Tredinnick, 15 years ago

Resolution: wontfix
Status: newclosed

That wouldn't solve any problem, since, by the same logic, the random record could contain bad data as well. It's just as likely. You're right about this being a problem with the database (since it let the bad data in there in the first place). This isn't a problem Django should even attempt to solve.

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