I haven't found any indication that this bug has been reported before, so I'll post it here.

Short description: When inserting timestamp values using the Python library and timstamp format INTERNAL, it is possible to insert invalid timestamps, such as 2500 hours.

Version: DB version 7.5.0.24, Python library version: 7.5.0.30 (SuSE Linux 8.2)

The following code will reproduce the error. In theory, both insert statements should throw a Python exception, since the timestamps are invalid. In practice, only the first insert statement throws an exception--the second succeeds!

When working with permanent tables, an attempt to query a row containing such an invalid value that was committed by another session returns an error code -9999.

#!/usr/bin/env python
import sapdb
db = sapdb.connect("USER","PASS",'DB','host')
db.sql("create table temp.tstest(tsid integer default serial primary key, ts timestamp default timestamp)")
try:
    db.sql("set format iso")
    db.sql("insert into temp.tstest set ts = '2005-05-02 25:11:00.000000'")
    db.commit()
    db.sql("select * from temp.tstest")
    print "Uh, oh--25:00 should not be permitted."
except:
    print "25:00 failed, as it should."

try:
    db.sql("set format internal")
    db.sql("insert into temp.tstest set ts = '20050502251100000000'")
    db.commit()
    db.sql("select * from temp.tstest")
    print "Uh, oh--25:00 should not be permitted."
except:
    print "25:00 failed, as it should."


--
Mark Thomas
United Drugs


--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to