Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#27 Interval parsing bug

open
nobody
None
5
2014-07-17
2006-12-05
Ken Lalonde
No

PgSQL.py 2.5.1 uses int() to parse the time part of a postgres interval string. When the seconds part contains a decimal, int() will throw a ValueError.

The attached patch just discards the decimal part, since mx.DateTime.RelativeTime stores seconds as an integer.

Discussion

  • Ken Lalonde
    Ken Lalonde
    2006-12-05

    Patch to pyPgSQL-2.5.1 PgSQL.py

     
    Attachments
  • Ken Lalonde
    Ken Lalonde
    2006-12-06

    Logged In: YES
    user_id=203927
    Originator: YES

    To be clear, here's a simple example that demonstrates the bug.
    We assume Db credentials are in the environment:

    from pyPgSQL import PgSQL
    db = PgSQL.connect()
    cur = db.cursor()
    cur.execute("select interval '2 years 3 days 12:34:56.78'")
    cur.fetchall()