pgtoolkit/pgbrowser.py
changeset 12 203be9022b46
parent 9 2fcc8ef0b97d
child 31 c2e6e24b83d9
--- a/pgtoolkit/pgbrowser.py	Fri Aug 19 17:08:34 2011 +0200
+++ b/pgtoolkit/pgbrowser.py	Tue Sep 06 17:55:15 2011 +0200
@@ -208,9 +208,10 @@
             ORDER BY 1;
             ''', schema)
 
-    def list_columns(self, table, schema='public'):
+    def list_columns(self, table, schema='public', order=2):
         return self._query('''
             SELECT
+                a.attrelid,
                 a.attname as "name",
                 format_type(a.atttypid, a.atttypmod) AS "type",
                 a.attnotnull as "notnull",
@@ -222,8 +223,7 @@
             LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
             LEFT JOIN pg_catalog.pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
             WHERE n.nspname = %s AND c.relname = %s AND a.attnum > 0 AND NOT a.attisdropped
-            ORDER BY 1
-            ''', schema, table)
+            ORDER BY ''' + str(order), schema, table)
 
     def list_constraints(self, table, schema='public'):
         return self._query('''