Bug #693: python interface doesn't handle int8 correctly. - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #693: python interface doesn't handle int8 correctly.
Date
Msg-id 20020618111450.2C13B4762B0@postgresql.org
Whole thread Raw
Responses Re: Bug #693: python interface doesn't handle int8 correctly.  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Bug #693: python interface doesn't handle int8 correctly.  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-bugs
Ragnar Kjørstad (postgresql@ragnark.vesdtata.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
willoverflow. 

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

pgsql-bugs by date:

Previous
From: Lee Kindness
Date:
Subject: ECPG: CREATE TABLE ... FOREIGN KEY(col) REFERENCES table(col)
Next
From: Aaron Mulder
Date:
Subject: JDBC Metadata Problems