From: Daniele Varrazzo Date: Mon, 6 Jun 2022 01:11:20 +0000 (+0200) Subject: fix(crdb): keep into account duplicate oids iterating types in registry X-Git-Tag: 3.1~49^2~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96fe9a53523db693ec8d075c7d6a30a75a3cae8d;p=thirdparty%2Fpsycopg.git fix(crdb): keep into account duplicate oids iterating types in registry In crdb there are a few aliases (e.g. json -> jsonb oid) which are not adequately captured by the type's regtype. --- diff --git a/psycopg/psycopg/_typeinfo.py b/psycopg/psycopg/_typeinfo.py index 9987ee5b2..de9a7b9e7 100644 --- a/psycopg/psycopg/_typeinfo.py +++ b/psycopg/psycopg/_typeinfo.py @@ -378,8 +378,8 @@ class TypesRegistry: def __iter__(self) -> Iterator[TypeInfo]: seen = set() for t in self._registry.values(): - if t.oid not in seen: - seen.add(t.oid) + if id(t) not in seen: + seen.add(id(t)) yield t @overload