Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit92798de

Browse files
committed
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 largerthan max integer.In the case where the column type is "BIGINT", the input d may very wellbe 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 aconcise 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 integerIf 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 ofint(d) should fix it. The following is a patch:Chih-Hao Huang
1 parentdd23a88 commit92798de

File tree

1 file changed

+1
-1
lines changed
  • src/interfaces/python

1 file changed

+1
-1
lines changed

‎src/interfaces/python/pg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def _quote(d, t):
1717

1818
iftin ['int','seq']:
1919
ifd=="":return"NULL"
20-
return"%d"%int(d)
20+
return"%d"%long(d)
2121

2222
ift=='decimal':
2323
ifd=="":return"NULL"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp