Re: [PATCH] Improve hstore support
От | Daniele Varrazzo |
---|---|
Тема | Re: [PATCH] Improve hstore support |
Дата | |
Msg-id | AANLkTi=VrF3kxFVux0J4CseObXnt=HPqTJvTcXpxicH7@mail.gmail.com обсуждение исходный текст |
Ответ на | [PATCH] Improve hstore support (Jean-Baptiste Quenot <jbq@caraldi.com>) |
Ответы |
Re: [PATCH] Improve hstore support
|
Список | psycopg |
2011/2/25 Jean-Baptiste Quenot <jbq@caraldi.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
В списке psycopg по дате отправления: