| From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
|---|---|
| To: | "Manera, Villiam" <vmanera(at)manord(dot)com> |
| Cc: | psycopg(at)postgresql(dot)org |
| Subject: | Re: R: strange characters |
| Date: | 2011-01-10 15:24:33 |
| Message-ID: | 201101100724.33395.adrian.klaver@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(dot)klaver(at)gmail(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniele Varrazzo | 2011-01-13 16:37:47 | Proposal: efficient iter on named cursors |
| Previous Message | Manera, Villiam | 2011-01-10 15:01:29 | R: strange characters |