From: <no...@so...> - 2002-11-12 04:53:54
|
Bugs item #636368, was opened at 2002-11-10 17:31 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=636368&group_id=16528 Category: PgSQL Group: None >Status: Closed >Resolution: Invalid Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Gerhard Häring (ghaering) Summary: insert with longinteger value Initial Comment: in an insert statement, a python long integer value like 1010L results in a parser error (something like "parser error at l". After conversion to a normal integer value with int() everything works fine. There will be a problem with very large integer values which can not be converted with int(). The error occured with the latest beta version. Pythonversion was 2.2.2, PostgreSQL- Version was 7.2.3 Christoph Becker ---------------------------------------------------------------------- >Comment By: Billy G. Allie (ballie01) Date: 2002-11-11 23:53 Message: Logged In: YES user_id=8500 This is not a problem with pyPgSQL. A Python long does not map to a PostgreSQL data type, so you must cast it to the appropiate type. For example, if the field you are trying to insert into is an integer8, you would use PgInt8(longvalue). If it is an integer, then int(longvalue) would do it. ---------------------------------------------------------------------- Comment By: Gerhard Häring (ghaering) Date: 2002-11-11 17:28 Message: Logged In: YES user_id=163326 Sorry, can't reproduce here: >>> cursor.execute("select * from test where a=%s", (10L**15,)) >>> print cursor.fetchone() [1000000000000000L] Please upload a test case that demonstrates the problem. ---------------------------------------------------------------------- Comment By: Gerhard Häring (ghaering) Date: 2002-11-11 11:00 Message: Logged In: YES user_id=163326 Hmm. I thought I fixed that for 2.3beta1. Plan to check it later today. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=636368&group_id=16528 |