Re: R: strange characters - Mailing list psycopg

From Adrian Klaver
Subject Re: R: strange characters
Date
Msg-id 201101100724.33395.adrian.klaver@gmail.com
Whole thread Raw
In response to R: strange characters  ("Manera, Villiam" <vmanera@manord.com>)
List psycopg
On Monday 10 January 2011 7:01:29 am Manera, Villiam wrote:
> Adrian wrote:
> >If you are referring to the 'E' it is not strange. That is the new
>
> Postgres
>
> >escape identifier. The backslash escape is being phased out.
>
> Ok, but the execute cursor will abort:
> >>> cur.execute("select * from anamat.collezioni where
>
> coll='%(coll)s'",{'coll':'1'});
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in <module>
> ProgrammingError: syntax error at or near "1"
> LINE 1: select * from anamat.collezioni where coll='E'1''
>
>
> Villiam

Well it should be E'1' not 'E'1''. This is because you are doing this '%(coll)s'
instead of this %(coll)s. In other words you are quoting the passed parameter.
In any case if coll is an integer column just pass an integer.

--
Adrian Klaver
adrian.klaver@gmail.com

psycopg by date:

Previous
From: "Manera, Villiam"
Date:
Subject: R: strange characters
Next
From: Daniele Varrazzo
Date:
Subject: Proposal: efficient iter on named cursors