Skip site navigation (1) Skip section navigation (2)

Bug #693: python interface doesn't handle int8 correctly.

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #693: python interface doesn't handle int8 correctly.
Date: 2002-06-18 11:14:50
Message-ID: 20020618111450.2C13B4762B0@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
Ragnar Kjrstad (postgresql(at)ragnark(dot)vesdtata(dot)no) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
python interface doesn't handle int8 correctly.

Long Description
This applies to postgresql 7.2.1 on linux x86 (32 bit)

getresult() and dictresult() return int4 data in a python int object, but it should use a python long object, or it will overflow.

From postgresql-7.2.1/src/interfaces/python:pgquery_dictresult  :
switch (PQftype(self->last_result, j)) {  
  case INT2OID:  
  case INT4OID:
  case INT8OID:
  case OIDOID:
     typ[j] = 1;
     break;
}
...
switch (typ[j]) {
  case 1:
    val = PyInt_FromLong(strtol(s, NULL, 10));
    break;
}


clearly this is wrong....


Sample Code


No file was uploaded with this report


Responses

pgsql-bugs by date

Next:From: Michael MeskesDate: 2002-06-18 12:48:12
Subject: Re: ECPG: CREATE TABLE ... FOREIGN KEY(col) REFERENCES table(col)
Previous:From: Lee KindnessDate: 2002-06-18 11:02:30
Subject: ECPG: CREATE TABLE ... FOREIGN KEY(col) REFERENCES table(col)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group