Improper handling of DATE, DATETIME, and TIMESTAMP fields

Bug #672059 reported by Raymond on 2010-11-07
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

If improper data is passed to these fields, or they are left blank while set to NOT NULL, MySQL will force their fields all to zero. The type handling code for 'fetchone' is not set up for this possibility, and the datetime module cannot handle such nonsensical dates, so the fetch fails. The old behavior for the MySQLdb module was to return None. Attached patch emulates that behavior.

Related branches

Raymond (raymond-wagnerrp) wrote :
Raymond (raymond-wagnerrp) wrote :

The patch is against the latest 0.9.2 tarball.

Changed in oursql:
importance: Undecided → High
milestone: none → 0.9.3
status: New → In Progress
Changed in oursql:
status: In Progress → Fix Committed
J Derek Wilson (nosliwkeredj) wrote :

i don't think this is a valid solution -- in my use case, sometimes we have date fields with YYYY-00-00 to represent a year if that is as specific as we can get. a better solution would be something like this:

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers