Improper handling of DATE, DATETIME, and TIMESTAMP fields

Bug #672059 reported by Raymond
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
oursql
Fix Committed
High
Unassigned

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

Revision history for this message
Raymond (raymond-wagnerrp) wrote :
Revision history for this message
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
Revision history for this message
J Derek Wilson (underrun) 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: https://bugs.launchpad.net/oursql/+bug/1076592

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.