[ python-Bugs-1010316 ] interval format inconsistency

noreply at pgfoundry.org noreply at pgfoundry.org
Fri Mar 14 14:37:15 UTC 2008


Bugs item #1010316, was opened at 2008-03-13 16:43
You can respond by visiting: 
http://pgfoundry.org/tracker/?func=detail&atid=442&aid=1010316&group_id=1000094

Category: fe/proboscis
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: James Pye (jwp)
Assigned to: James Pye (jwp)
Summary: interval format inconsistency

Initial Comment:
>>> ~query("SELECT timeofday()::timestamp - now()::timestamp")
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "build/bdist.macosx-10.5-i386/egg/postgresql/interface/proboscis/tracenull.py", line 1147, in first
    return io(xt[0])
  File "build/bdist.macosx-10.5-i386/egg/postgresql/protocol/typical/stdio.py", line 92, in <lambda>
    lambda x: interval_unpack(ps.interval_unpack(x))
  File "build/bdist.macosx-10.5-i386/egg/postgresql/protocol/typical/pstruct.py", line 125, in interval_unpack
    tim, day, month = dll_unpack(data)
error: unpack requires a string argument of length 16

This works in 8.2, but not 8.0. I imagine the wire format changed. This will need to be a specific override in proboscis.

Both in 0.9.4 and 1.0dev.

----------------------------------------------------------------------

>Comment By: James Pye (jwp)
Date: 2008-03-14 07:37

Message:
I have a fix for this locally.

Simply, create another version of the interval packers and use dl_ instead of dll_. These new versions retain compatibility with the `days present` variants by zero-ing the days(ie, still takes and returns a triple, but the day is always zero).

Sadly, I'm either subjected to detecting the format by issuing an additional query on connect, or by version analysis(version_info <= 8,0). Currently, I'm leaning toward the version as I'd prefer to not add additional roundtrips to the cost of the startup.

----------------------------------------------------------------------

You can respond by visiting: 
http://pgfoundry.org/tracker/?func=detail&atid=442&aid=1010316&group_id=1000094


More information about the Python-general mailing list