]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
fix(crdb): keep into account duplicate oids iterating types in registry
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 6 Jun 2022 01:11:20 +0000 (03:11 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 12 Jul 2022 11:58:34 +0000 (12:58 +0100)
In crdb there are a few aliases (e.g. json -> jsonb oid) which are not
adequately captured by the type's regtype.

psycopg/psycopg/_typeinfo.py

index 9987ee5b2b7ed3da418cd39d07a014e1dba170e6..de9a7b9e7400ae09bd25e91642ca34d2f5db7d1d 100644 (file)
@@ -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