Skip to content
Permalink
Browse files

[DbManager] fetch type of view (materialized or not) and show in info

(refs #13829)
  • Loading branch information
SebDieBln authored and brushtyler committed Jan 26, 2016
1 parent e42819d commit 50878114a7157465278ff11581494681c0339b92
@@ -311,7 +311,7 @@ def getTables(self, schema=None, add_sys_tables=False):

# get all tables and views
sql = u"""SELECT
cla.relname, nsp.nspname, cla.relkind = 'v' OR cla.relkind = 'm',
cla.relname, nsp.nspname, cla.relkind,
pg_get_userbyid(relowner), reltuples, relpages,
pg_catalog.obj_description(cla.oid)
FROM pg_class AS cla
@@ -367,7 +367,7 @@ def getVectorTables(self, schema=None):

# discovery of all tables and whether they contain a geometry column
sql = u"""SELECT
cla.relname, nsp.nspname, cla.relkind = 'v' OR cla.relkind = 'm',
cla.relname, nsp.nspname, cla.relkind,
pg_get_userbyid(relowner), cla.reltuples, cla.relpages,
pg_catalog.obj_description(cla.oid),
""" + geometry_fields_select + """
@@ -439,7 +439,7 @@ def getRasterTables(self, schema=None):

# discovery of all tables and whether they contain a raster column
sql = u"""SELECT
cla.relname, nsp.nspname, cla.relkind = 'v' OR cla.relkind = 'm',
cla.relname, nsp.nspname, cla.relkind,
pg_get_userbyid(relowner), cla.reltuples, cla.relpages,
pg_catalog.obj_description(cla.oid),
""" + raster_fields_select + """
@@ -44,8 +44,9 @@ def generalInfo(self):

tbl = [
(QApplication.translate("DBManagerPlugin", "Relation type:"),
QApplication.translate("DBManagerPlugin", "View") if self.table.isView else QApplication.translate(
"DBManagerPlugin", "Table")),
QApplication.translate("DBManagerPlugin", "View") if self.table._relationType == 'v' else
QApplication.translate("DBManagerPlugin", "Materialized view") if self.table._relationType == 'm' else
QApplication.translate("DBManagerPlugin", "Table")),
(QApplication.translate("DBManagerPlugin", "Owner:"), self.table.owner)
]
if self.table.comment:
@@ -160,7 +160,8 @@ class PGTable(Table):

def __init__(self, row, db, schema=None):
Table.__init__(self, db, schema)
self.name, schema_name, self.isView, self.owner, self.estimatedRowCount, self.pages, self.comment = row
self.name, schema_name, self._relationType, self.owner, self.estimatedRowCount, self.pages, self.comment = row
self.isView = self._relationType in set(['v', 'm'])
self.estimatedRowCount = int(self.estimatedRowCount)

def runVacuumAnalyze(self):

0 comments on commit 5087811

Please sign in to comment.
You can’t perform that action at this time.