53 |
53 |
54 |
54 |
55 class Index: |
55 class Index: |
56 def __init__(self, browser, table, |
56 def __init__(self, browser, table, |
57 name, primary, unique, clustered, valid, definition, |
57 name, primary, unique, clustered, valid, definition, |
58 columns): |
58 columns, size): |
59 self.browser = browser |
59 self.browser = browser |
60 self.table = table |
60 self.table = table |
61 self.name = name |
61 self.name = name |
62 self.primary = primary |
62 self.primary = primary |
63 self.unique = unique |
63 self.unique = unique |
64 self.clustered = clustered |
64 self.clustered = clustered |
65 self.valid = valid |
65 self.valid = valid |
66 self.definition = definition |
66 self.definition = definition |
67 self.columns = columns |
67 self.columns = columns |
|
68 self.size = size |
68 |
69 |
69 |
70 |
70 class Table: |
71 class Table: |
71 def __init__(self, browser, schema, name, owner, size, description, options): |
72 def __init__(self, browser, schema, name, owner, size, description, options): |
72 self._columns = None |
73 self._columns = None |
343 i.indisprimary as "primary", |
344 i.indisprimary as "primary", |
344 i.indisunique as "unique", |
345 i.indisunique as "unique", |
345 i.indisclustered as "clustered", |
346 i.indisclustered as "clustered", |
346 i.indisvalid as "valid", |
347 i.indisvalid as "valid", |
347 pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) as "definition", |
348 pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) as "definition", |
348 ARRAY(SELECT a.attname FROM pg_catalog.pg_attribute a WHERE a.attrelid = c2.oid ORDER BY attnum) AS "columns" |
349 ARRAY(SELECT a.attname FROM pg_catalog.pg_attribute a WHERE a.attrelid = c2.oid ORDER BY attnum) AS "columns", |
|
350 pg_catalog.pg_relation_size(c2.oid) as "size" |
349 --c2.reltablespace as "tablespace_oid" |
351 --c2.reltablespace as "tablespace_oid" |
350 FROM pg_catalog.pg_class c |
352 FROM pg_catalog.pg_class c |
351 JOIN pg_catalog.pg_index i ON c.oid = i.indrelid |
353 JOIN pg_catalog.pg_index i ON c.oid = i.indrelid |
352 JOIN pg_catalog.pg_class c2 ON i.indexrelid = c2.oid |
354 JOIN pg_catalog.pg_class c2 ON i.indexrelid = c2.oid |
353 JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace |
355 JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace |