From: Karsten H. <Kar...@gm...> - 2005-01-13 00:00:23
|
> >>i'm wondering why i get the following error witht he code below > >>i'm guessing it's probably somethign very simple i'm goign wrong, most > >>likely to do with my new line escapes \ > >>if there is a better way of formatting my query to fix this i'm all ears. > >> > >> > >consider using > > > >query = """ > >... any formatting you want > >""" > > > >No \ needed. > > > >Karsten > > > > > ok i did that b ut i still get the error > > cur.execute("""CREATE OR REPLACE FUNCTION week_num ( date ) > File "/usr/local/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line > 3072, in execute > raise OperationalError, msg > libpq.OperationalError: ERROR: syntax error at or near "20040701" at > character 92 The error seems to be in the first function declaration. In there you have the %s *inside* the actual function body. I doubt that pyPgSQL knows about the proper quoting rules for that case, eg quotes need to be doubled at least, even tripled or quadrupled in some special cases. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 |