pgtoolkit/pgbrowser.py
changeset 35 e7f79c4a27ce
parent 32 d59c473c9ad7
child 40 922d7fb63384
--- a/pgtoolkit/pgbrowser.py	Thu May 10 08:42:21 2012 +0200
+++ b/pgtoolkit/pgbrowser.py	Fri May 11 14:16:36 2012 +0200
@@ -228,12 +228,16 @@
     def list_constraints(self, table, schema='public'):
         return self._query('''
             SELECT
-                conname as "name",
-                r.contype as "type",
+                r.conname AS "name",
+                r.contype AS "type",
+                cf.relname AS "fname",
+                nf.nspname AS "fschema",
                 pg_catalog.pg_get_constraintdef(r.oid, true) as "definition"
             FROM pg_catalog.pg_constraint r
             JOIN pg_catalog.pg_class c ON r.conrelid = c.oid
             JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
+            LEFT JOIN pg_catalog.pg_class cf ON r.confrelid = cf.oid
+            LEFT JOIN pg_catalog.pg_namespace nf ON nf.oid = cf.relnamespace
             WHERE n.nspname = %s AND c.relname = %s
             ORDER BY 1
             ''', [schema, table])