Re: Error in PostgreSQL query with psycopg - Mailing list pgsql-general

From Volkan YAZICI
Subject Re: Error in PostgreSQL query with psycopg
Date
Msg-id 20060801061221.GB1323@alamut.tdm.local
Whole thread Raw
In response to Re: Error in PostgreSQL query with psycopg  ("Parthan SR" <python.technofreak@gmail.com>)
List pgsql-general
On Jul 31 10:40, Parthan SR wrote:
> On 7/31/06, Richard Huxton <dev@archonet.com> wrote:
> Traceback (most recent call last): File
> "/usr/lib/cgi-bin/ConfSachem/page2.py", line 75, in ? main(num_days) File
> "/usr/lib/cgi-bin/ConfSachem/page2.py", line 68, in main query =
> cursor.execute('INSERT INTO ConfMain (ConfName, ConfHost, ConfStart,
> ConfEnd, ConfDays, ConfStartTime, ConfEndTime, ConfSize) VALUES (?, ?, ?, ?,
> ?, ?, ?, ?)', (conf_name, host_name, start_day, end_day, num_days,
> start_time, end_time, aud_size)) psycopg.ProgrammingError: ERROR: syntax
> error at or near "," at character 120 INSERT INTO ConfMain (ConfName,
> ConfHost, ConfStart, ConfEnd, ConfDays, ConfStartTime, ConfEndTime,
> ConfSize) VALUES (?, ?, ?, ?, ?, ?, ?, ?)

Did you follow the 120 character? It points to ',' just after '?'. Can
you please replace '?' character with '%s'. I'm not sure but, IIRC,
psycopg variable using method (e.g. "$1, $2, ..." or "?, ?, ...")
should be adjustable.


Regards.

pgsql-general by date:

Previous
From: "Parthan SR"
Date:
Subject: Re: Error in PostgreSQL query with psycopg
Next
From: Roman Neuhauser
Date:
Subject: Re: Triggers in Postgres