aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/python
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2003-06-25 01:09:24 +0000
committerBruce Momjian <bruce@momjian.us>2003-06-25 01:09:24 +0000
commit92798de02ef3a27469f46e6a0996b97ec98d0c0c (patch)
treed10df115efc12c3a93633986b692ecd3cf0236af /src/interfaces/python
parentdd23a882fad306c54e192d5f60e459c691d996af (diff)
downloadpostgresql-92798de02ef3a27469f46e6a0996b97ec98d0c0c.tar.gz
postgresql-92798de02ef3a27469f46e6a0996b97ec98d0c0c.zip
This is a bug in python interface module,
postgresql-7.3.3/src/interfaces/python/pg.py. _quote() function fails due to integer overflow if input d is larger than max integer. In the case where the column type is "BIGINT", the input d may very well be larger than max integer while its type, t, is labeled 'int'. The conversion on line 19, return "%d" % int(d), will fail due to "OverflowError: long int too large to convert to int". Please describe a way to repeat the problem. Please try to provide a concise reproducible example, if at all possible: ---------------------------------------------------------------------- [1] create a table with a column type 'BIGINT'. [2] use pg.DB.insert() to insert a value that is larger than max integer If you know how this problem might be fixed, list the solution below: --------------------------------------------------------------------- Just changing the conversion at line 19 of pg.py to long(d) instead of int(d) should fix it. The following is a patch: Chih-Hao Huang
Diffstat (limited to 'src/interfaces/python')
-rw-r--r--src/interfaces/python/pg.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/interfaces/python/pg.py b/src/interfaces/python/pg.py
index 5fd36eed344..0380dc4de9a 100644
--- a/src/interfaces/python/pg.py
+++ b/src/interfaces/python/pg.py
@@ -17,7 +17,7 @@ def _quote(d, t):
if t in ['int', 'seq']:
if d == "": return "NULL"
- return "%d" % int(d)
+ return "%d" % long(d)
if t == 'decimal':
if d == "": return "NULL"