diff options
author | Amjith Ramanujam <amjith.r@gmail.com> | 2015-01-26 00:19:49 -0800 |
---|---|---|
committer | Amjith Ramanujam <amjith.r@gmail.com> | 2015-01-26 00:19:49 -0800 |
commit | 750206c779060ea8b1cf19e2058a87cd536363e2 (patch) | |
tree | 2ebaabb319d1223beaef4af439afaabe9fbd9058 /pgcli/pgexecute.py | |
parent | 9c72e59216969867fd6a3efffc43737e980405fb (diff) |
Handle unicode for hstore and unknown types. Fixes #134.
Diffstat (limited to 'pgcli/pgexecute.py')
-rw-r--r-- | pgcli/pgexecute.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py index c11d42c1..5ba0dcd3 100644 --- a/pgcli/pgexecute.py +++ b/pgcli/pgexecute.py @@ -2,7 +2,7 @@ import sys import logging import psycopg2 import psycopg2.extras -import psycopg2.extensions +import psycopg2.extensions as ext import sqlparse from collections import defaultdict from .packages import pgspecial @@ -14,8 +14,10 @@ _logger = logging.getLogger(__name__) # Cast all database input to unicode automatically. # See http://initd.org/psycopg/docs/usage.html#unicode-handling for more info. -psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) -psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY) +ext.register_type(psycopg2.extensions.UNICODE) +ext.register_type(psycopg2.extensions.UNICODEARRAY) +ext.register_type(ext.new_type((705,), "UNKNOWN", ext.UNICODE)) +ext.register_type(ext.new_type((51766,), "HSTORE", ext.UNICODE)) # Cast bytea fields to text. By default, this will render as hex strings with # Postgres 9+ and as escaped binary in earlier versions. |