1
1
mirror of https://github.com/dbcli/pgcli.git synced 2024-10-04 09:17:08 +03:00

Determine hstore OID from the system view (#992)

Avoid error message on the server side if hstore
extension is not installed in the current database.

Issue: https://github.com/dbcli/pgcli/issues/991
This commit is contained in:
Marcin Cieślak 2019-01-22 01:00:25 +01:00 committed by Irina Truong
parent f614cef7ed
commit ef8aac61c4
3 changed files with 8 additions and 3 deletions

View File

@ -88,6 +88,7 @@ Contributors:
* Daniel Egger
* Ignacio Campabadal
* Mikhail Elovskikh (wronglink)
* Marcin Cieślak (saper)
Creator:
--------

View File

@ -1,7 +1,9 @@
Upcoming:
=========
TODO
Bug fixes:
----------
* Avoid error message on the server side if hstore extension is not installed in the current database (#991). (Thanks: `Marcin Cieślak`_)
2.0.2:
======
@ -923,4 +925,5 @@ Improvements:
.. _`Max Rothman`: https://github.com/maxrothman
.. _`Daniel Egger`: https://github.com/DanEEStar
.. _`Ignacio Campabadal`: https://github.com/igncampa
.. _`Mikhail Elovskikh`: https://github.com/wronglink
.. _`Mikhail Elovskikh`: https://github.com/wronglink
.. _`Marcin Cieślak`: https://github.com/saper

View File

@ -113,7 +113,8 @@ def register_hstore_typecaster(conn):
"""
with conn.cursor() as cur:
try:
cur.execute("SELECT 'hstore'::regtype::oid")
cur.execute(
"select t.oid FROM pg_type t WHERE t.typname = 'hstore' and t.typisdefined")
oid = cur.fetchone()[0]
ext.register_type(ext.new_type((oid,), "HSTORE", ext.UNICODE))
except Exception: