Re: so, is connection.poll() supposed to block?

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: so, is connection.poll() supposed to block?
Дата
Msg-id CA+mi_8YHGpZKMBmnW6-Rc4QgV+EscTtej_FnWzsHv_QsaeCsbA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: so, is connection.poll() supposed to block?  (Croepha <croepha@gmail.com>)
Список psycopg
On Tue, Oct 4, 2011 at 5:21 PM, Croepha <croepha@gmail.com> wrote:

> I just wan't to verify my understanding of how psycopg2 works:
> 1. Can synchronous connections can block on poll?

Likely. Just to start, you call functions on a libpq connection that
hasn't set in nonblocking mode. I'd leave what happens in the realm of
the undefined.

> 2. Are you allowed to set client encoding in an asynchronous connection?
> (mine gives me an exception when I try) if not, why not?

No, you are not, it is documented among the shortcomings of async
connections <http://initd.org/psycopg/docs/advanced.html#async-support>.
The reason is that every query requires to be "pumped" manually to the
database and the result pumped back, so we allow the user to do that
on the query they run via execute(), but specifically forbid any
method that would send a query behind the scene, which otherwise would
require the same treatment.

You can set the env variable PGCLIENTENCODING or use
client_encoding=BLAH in the connection string at connection time, not
change it afterwards.

-- Daniele

В списке psycopg по дате отправления:

Предыдущее
От: Croepha
Дата:
Сообщение: Re: so, is connection.poll() supposed to block?
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: psycopg, pgpool and closing connections