]> granicus.if.org Git - postgresql/commitdiff
Add oid to list of keys cached.
authorD'Arcy J.M. Cain <darcy@druid.net>
Sat, 3 Mar 2001 13:58:24 +0000 (13:58 +0000)
committerD'Arcy J.M. Cain <darcy@druid.net>
Sat, 3 Mar 2001 13:58:24 +0000 (13:58 +0000)
Add a test to avoid an exception in certain cases.

src/interfaces/python/pg.py

index a3e0bfc9b02e8fc37c9e2ae8b4dfb7d85e61a55d..6f458af5aa873f2b64a8a92974c81b562b17388c 100644 (file)
@@ -139,7 +139,8 @@ class DB:
                        else:
                                l[attname] = 'text'
 
-               self.__attnames__[cl] = l
+               l['oid'] = 'int'                                # every table has this
+               self.__attnames__[cl] = l               # cache it
                return self.__attnames__[cl]
 
        # return a tuple from a database
@@ -194,7 +195,7 @@ class DB:
                l = []
                n = []
                for f in fnames.keys():
-                       if a.has_key(f):
+                       if f != 'oid' and a.has_key(f):
                                l.append(_quote(a[f], fnames[f]))
                                n.append(f)
 
@@ -228,7 +229,7 @@ class DB:
                fnames = self.get_attnames(cl)
 
                for ff in fnames.keys():
-                       if a.has_key(ff):
+                       if ff != 'oid' and a.has_key(ff):
                                v.append("%s = %s" % (ff, _quote(a[ff], fnames[ff])))
 
                if v == []: