From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
---|---|
To: | Jean-Baptiste Quenot <jbq(at)caraldi(dot)com> |
Cc: | psycopg(at)postgresql(dot)org |
Subject: | Re: [PATCH] Improve hstore support |
Date: | 2011-02-25 18:13:57 |
Message-ID: | AANLkTi=VrF3kxFVux0J4CseObXnt=HPqTJvTcXpxicH7@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
2011/2/25 Jean-Baptiste Quenot <jbq(at)caraldi(dot)com>:
> Hi all,
>
> Please find attached a patch to make the hstore extension work
> reliably with RealDictConnection, and hstore type installed in a
> custom schema.
Thank you JB,
yesterday I already pushed a patch to register hstore in whatever
schema it is registered, so half of the patch is already in, albeit in
a different form.
As you have noticed, installation fails if the connection is a
RealDictConnection. Do you want to reformulate the patch on the most
up-to-date devel? You can clone my git repos at
<https://github.com/dvarrazzo/psycopg/> and patch from there. Please,
if you provide a patch, also provide a test case for it, e.g. in
tests/extras_dictcursor.py.
Please note that RealDictCursor is advertised as a "specialized" one
(see http://initd.org/psycopg/docs/extras.html#real-dictionary-cursor)
it is documented that it doesn't respect the dbapi interface so I
expect several higher level areas of the libraries not working
correctly with them. You can work around the problem in
register_hstore() by manually querying an oid and passing it as
register_hstore oid keyword (see
http://initd.org/psycopg/docs/extras.html#psycopg2.extras.register_hstore
- the feature is new in 2.4). Other cursor types more specialized but
still respectful of the dbapi (e.g. NamedTupleConnection) have no
problem with register_hstore.
So, given the fact that RealDictCursor is not dbapi-compliant and the
oid is a workaround for the issue, do we really want to have
register_hstore() extended to support it? We would need **tests** and
patches in a lot of different areas, pretty much everything into
psycopg that creates a cursor. connection.tpc_recover() and
extras.register_composite() are the first coming to mind that are
likely equally broken. Comments?
-- Daniele
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2011-02-26 16:11:28 | zope+zope |
Previous Message | Jean-Baptiste Quenot | 2011-02-25 16:53:36 | [PATCH] Improve hstore support |