Issue 283: Integer Limit Reached
Status:  Hold
Owner: ----
Reported by flavien....@gmail.com, Aug 14, 2012
Here's my piece of code:
cnxn = pyodbc.connect('DSN=VerticaDSN') #This is my Vertica database

cursor_count = cnxn.cursor()
count = cursor_count.execute("SELECT count(*) FROM bootups;").fetchone()[0]
print count

What is the expected output? What do you see instead?
This outputs -1065376128. The correct value should be 3230392212.
I investigated python max int size and also the other issues on this board but couldn't find a clear resolution to the problem.

What version of the product are you using? On what operating system?
Latest. On CentOS. Python 2.6

Please provide any additional information below.

Aug 15, 2012
#1 flavien....@gmail.com
It got solved by "faking" my data to be a varchar instead of an integer. SImply using a cast function into my select command. Still unclear on what is really the issue tho.
Aug 16, 2012
Project Member #2 mkleehammer
Didn't reproduce it on 64-bit OS/X 2.7.  Will try on a 32-bit Windows box tomorrow, which also has 2.6.

Is the CentOS box 32 or 64 bit?  Also, can you provide sys.maxint?

Status: Investigating
Aug 16, 2012
#3 flavien....@gmail.com
Here are some more information about the server:
Platform | Linux
Release | CentOS release 5.5 (Final)
Kernel | 2.6.35.11-83.9.amzn1.x86_64
Architecture | CPU = 64-bit, OS = 64-bit

sys.maxint => 9223372036854775807
Sep 27, 2012
Project Member #4 mkleehammer
This seems like is a driver issue.  I've added the following to pgtests (PostgreSQL) on tested with OS/X pyodbc 3.0.6

    def test_int_limits(self):
        values = [ (-sys.maxint - 1), -1, 0, 1, 3230392212, sys.maxint ]

        self.cursor.execute("create table t1(a bigint)")

        for value in values:
            self.cursor.execute("delete from t1")
            self.cursor.execute("insert into t1 values(?)", value)
            v = self.cursor.execute("select a from t1").fetchone()[0]
            self.assertEqual(v, value)

Can you generate an ODBC trace?
Status: Hold
Sep 29, 2012
Project Member #5 mkleehammer
(No comment was entered for this change.)
Labels: Driver-Vertica