]> granicus.if.org Git - postgresql/commitdiff
Well, that certainly appeared to be very straight forward. pg.py and
authorBruce Momjian <bruce@momjian.us>
Thu, 15 Aug 2002 03:32:36 +0000 (03:32 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 15 Aug 2002 03:32:36 +0000 (03:32 +0000)
syscat.py scripts were both modified.  pg.py uses it to cache a list of
pks (which is seemingly does for every db connection) and various
attributes.  syscat uses it to walk the list of system tables and
queries the various attributes from these tables.

In both cases, it seemingly makes sense to apply what you've requested.

Greg Copeland

src/interfaces/python/pg.py
src/interfaces/python/tutorial/syscat.py

index d9d34d872c8a4060afb86711b1d027e0f5747294..6a8d8ac78a2b1600410dea16779d4d56cb771c01 100644 (file)
@@ -69,7 +69,8 @@ class DB:
                                                WHERE pg_class.oid = pg_attribute.attrelid AND
                                                        pg_class.oid = pg_index.indrelid AND
                                                        pg_index.indkey[0] = pg_attribute.attnum AND 
-                                                       pg_index.indisprimary = 't'""").getresult():
+                                                       pg_index.indisprimary = 't' AND
+                                                       pg_attribute.attisdropped = 'f'""").getresult():
                        self.__pkeys__[rel] = att
 
        # wrap query for debugging
@@ -111,7 +112,8 @@ class DB:
                                        WHERE pg_class.relname = '%s' AND
                                                pg_attribute.attnum > 0 AND
                                                pg_attribute.attrelid = pg_class.oid AND
-                                               pg_attribute.atttypid = pg_type.oid"""
+                                               pg_attribute.atttypid = pg_type.oid AND
+                                               pg_attribute.attisdropped = 'f'"""
 
                l = {}
                for attname, typname in self.db.query(query % cl).getresult():
index f45d62470d0bbeaca0d0dc95540cabf13f32ee94..1ab1d5840c2c06c7cfcd6250f91d82a280170fc8 100755 (executable)
@@ -37,7 +37,7 @@ def list_simple_ind(pgcnx):
                FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a
                WHERE i.indrelid = bc.oid AND i.indexrelid = bc.oid
                                AND i.indkey[0] = a.attnum AND a.attrelid = bc.oid
-                               AND i.indproc = '0'::oid
+                               AND i.indproc = '0'::oid AND a.attisdropped = 'f'
                ORDER BY class_name, index_name, attname""")
        return result
 
@@ -48,6 +48,7 @@ def list_all_attr(pgcnx):
                WHERE c.relkind = 'r' and c.relname !~ '^pg_'
                        AND c.relname !~ '^Inv' and a.attnum > 0
                        AND a.attrelid = c.oid and a.atttypid = t.oid
+                        AND a.attisdropped = 'f'
                        ORDER BY relname, attname""")
        return result