Re: Error in PostgreSQL query with psycopg

From: Volkan YAZICI <yazicivo(at)ttnet(dot)net(dot)tr>
To: Parthan SR <python(dot)technofreak(at)gmail(dot)com>
Cc: Richard Huxton <dev(at)archonet(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Error in PostgreSQL query with psycopg
Date: 2006-08-01 06:12:21
Message-ID: 20060801061221.GB1323@alamut.tdm.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jul 31 10:40, Parthan SR wrote:
> On 7/31/06, Richard Huxton <dev(at)archonet(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasbinder Bali 2006-08-01 06:35:48 Re: Triggers in Postgres
Previous Message Christian Kastner 2006-08-01 05:53:01 Re: pg_xlog not cleaned up