Re: register_hstore does DB queries, does not play well with async connections

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: register_hstore does DB queries, does not play well with async connections
Дата
Msg-id AANLkTimjXMnHPbpm--5WcXZcpARc8OtDj2yNZMUER4c2@mail.gmail.com
обсуждение исходный текст
Ответ на register_hstore does DB queries, does not play well with async connections  (Jan Urbański <wulczer@wulczer.org>)
Ответы Re: register_hstore does DB queries, does not play well with async connections  (Jan Urbański <wulczer@wulczer.org>)
Список psycopg
On Sun, Feb 20, 2011 at 10:08 PM, Jan Urbański <wulczer@wulczer.org> wrote:
> Hi,
>
> as per $SUBJECT. If you have an async connection and try to do
> register_hstore, it does a query to get hstore's OID, and does not do
> poll(), which results in an error in fetchone().
>
> I think the solution is to allow people to pass the OID in
> register_hstore and document that you have to do it if using async
> connections. Currently I'm doing the select myself (asynchronously) and
> monkeypatching HstoreAdapter's get_oids to just return the OID.

It seems an useful feature. Added
(https://github.com/dvarrazzo/psycopg/commit/143dc2e9).

> BTW: the query assumes you have hstore installed in the "public" schema,
> which might not be correct... How about allowing passing the
> fully-qualified type name to register_hstore?

Is this really a real use case? the 'public' schema is specified in
contrib/hstore.sql so you would need to hack the installer to put the
hstore somewhere else. Even if someone did this, the oid parameter
would allow to specify the type working around the hardcoded schema in
get_oids. Then there are the casts: I assume if the installation
schema was in the search_path they would work anyway, but I haven't
done any test after seeing that the installer always put hstore in
public: if installing hstore somewhere else is really something people
do we can think about that. Otherwise I would avoid further
complicating the interface of a function with already 4 parameters.

Thank you, bye!

-- Daniele

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

Предыдущее
От: Jan Urbański
Дата:
Сообщение: register_hstore does DB queries, does not play well with async connections
Следующее
От: Jan Urbański
Дата:
Сообщение: Re: register_hstore does DB queries, does not play well with async connections