Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Large interval not returned correctly as timedelta #512
The PG interval "999999:00:00" gets returned from psycopg2 as
You are right, there was an integer overflow indeed.
While I could fix it no problem on Linux, weirdly the problem doesn't disappear on Windows. I rewrote the parsing algorithm to do without almost any floating point operation and only using longs... and this is still baffling me. Could it be the case that on Windows the Python interval is buggy? @jerickso, do you get these results on Windows? If so what could be the difference?
Unfortunately it doesn't seem to be Python on windows:
And it is not the assert compare (even tho it is returning a float instead of an int)
Looking at the error message closer, -694970896 is the signed two's complement representation of 3599996400. So it is a size issue.
MS's 'long' type is the same size as an 'int' type, regardless if compiling for 32bit or 64bit.
We could use 'long long' with the python format value of 'L', or if the size needs to change based upon the platform, we've used Py_ssize_t in the past.