Update of /usr/cvs/Public/pygresql/module
In directory druid.net:/tmp/cvs-serv17173
Modified Files:
pg.py
Log Message:
Added note about composite primary keys.
To see the diffs for this commit:
http://www.druid.net/pygresql/viewcvs.cgi/cvs/pygresql/module/pg.py.diff?r1=1.71&r2=1.72
Index: pg.py
===================================================================
RCS file: /usr/cvs/Public/pygresql/module/pg.py,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- pg.py 4 Dec 2008 20:12:52 -0000 1.71
+++ pg.py 4 Dec 2008 20:28:06 -0000 1.72
@@ -5,7 +5,7 @@
# Written by D'Arcy J.M. Cain
# Improved by Christoph Zwerschke
#
-# $Id: pg.py,v 1.71 2008/12/04 20:12:52 cito Exp $
+# $Id: pg.py,v 1.72 2008/12/04 20:28:06 cito Exp $
#
"""PyGreSQL classic interface.
@@ -328,13 +328,15 @@
self._pkeys = dict([
(_join_parts(r[:2]), r[2]) for r in self.db.query(
"SELECT pg_namespace.nspname, pg_class.relname"
- ",pg_attribute.attname FROM pg_class"
+ ", pg_attribute.attname FROM pg_class"
" JOIN pg_namespace ON pg_namespace.oid=pg_class.relnamespace"
" AND pg_namespace.nspname NOT LIKE 'pg_%'"
" JOIN pg_attribute ON pg_attribute.attrelid=pg_class.oid"
" AND pg_attribute.attisdropped='f'"
" JOIN pg_index ON pg_index.indrelid=pg_class.oid"
" AND pg_index.indisprimary='t'"
+ # note that this gets only the first attribute
+ # of composite primary keys
" AND pg_index.indkey[0]=pg_attribute.attnum"
).getresult()])
self._do_debug(self._pkeys)
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql