Re: R: strange characters

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: R: strange characters
Дата
Msg-id 201101100724.33395.adrian.klaver@gmail.com
обсуждение исходный текст
Ответ на R: strange characters  ("Manera, Villiam" <vmanera@manord.com>)
Список 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 по дате отправления:

Предыдущее
От: "Manera, Villiam"
Дата:
Сообщение: R: strange characters
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Proposal: efficient iter on named cursors