From: Daniele Varrazzo Date: Tue, 24 Aug 2021 19:08:43 +0000 (+0200) Subject: Fix typeinfo fetch of alt_name X-Git-Tag: 3.0.beta1~43^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3fe14a0bbdbe110b8766091b863df9311d4c7c1d;p=thirdparty%2Fpsycopg.git Fix typeinfo fetch of alt_name It was returned as the binary value of the oid number. --- diff --git a/psycopg/psycopg/_typeinfo.py b/psycopg/psycopg/_typeinfo.py index 8fff12c16..16cf6687f 100644 --- a/psycopg/psycopg/_typeinfo.py +++ b/psycopg/psycopg/_typeinfo.py @@ -143,7 +143,7 @@ class TypeInfo: _info_query = """\ SELECT typname AS name, oid, typarray AS array_oid, - oid::regtype AS alt_name, typdelim AS delimiter + oid::regtype::text AS alt_name, typdelim AS delimiter FROM pg_type t WHERE t.oid = %(name)s::regtype ORDER BY t.oid diff --git a/tests/test_typeinfo.py b/tests/test_typeinfo.py index 8a209d128..11b8b9f1f 100644 --- a/tests/test_typeinfo.py +++ b/tests/test_typeinfo.py @@ -23,6 +23,7 @@ def test_fetch(conn, name, status): assert info.oid == psycopg.adapters.types["text"].oid assert info.array_oid == psycopg.adapters.types["text"].array_oid + assert info.alt_name == "text" @pytest.mark.asyncio