From: <no...@so...> - 2002-09-28 13:54:08
|
Support Requests item #615598, was opened at 2002-09-27 19:48 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=216528&aid=615598&group_id=16528 Category: PgSQL.py Group: None Status: Open Priority: 5 Submitted By: Wild Bill (wildbilly) Assigned to: Nobody/Anonymous (nobody) Summary: Unintuitive error messages Initial Comment: Hello, My python code looks like this: cursor.execute("""INSERT INTO table1 VALUES(%s, %s, %s, %s, %s, %s, %s)""", (iurl, tags2, val2, depth, val3, val4, val5)) And the error message looks like this: libpq.OperationalError ERROR: parser: parse error at or near "l" Which means absolutely nothing to me. I try some debugging code to see what the SQL looks like: print """INSERT INTO able1 VALUES(%s, %s, %s, %s, %s, %s, %s);""" % (iurl, tags2, val2, depth, val3, val4, val5) Which outputs INSERT INTO table1 VALUES(http://www.dmoz.org/Society/, 0, 3, 500, 50000, 200209271030, 0); Any thoughts? Does PgSQL module take care of backslashing, adding appropriate apostraphes, etc? I can't find any documentation on this anywhere. Thanks ---------------------------------------------------------------------- >Comment By: Gerhard Häring (ghaering) Date: 2002-09-28 15:54 Message: Logged In: YES user_id=163326 Using the % operator yourself doesn't help for debugging. Please activate SQL logging by accessing the toggleShowQuery attribute on the low-level connection attribute, something like this: from pyPgSQL import PgSQL con = PgSQL.connect(...) con.con.toggleShowQuery cursor = con.cursor() cursor.execute(...) Could you please post the SQL that gets sent to the backend? Btw. the libpq.OperationalError comes from the PostgreSQL backend. We can't do much about improving it. It just means PostgreSQL cannot parse the SQL statement it gets sent. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=216528&aid=615598&group_id=16528 |