TablesTableModel now also shows (materialized) views en foreign tables.
This commit is contained in:
parent
a0579538df
commit
f0ffcf4abd
4 changed files with 8 additions and 2 deletions
|
|
@ -40,7 +40,8 @@ void TablesTableModel::reloadData()
|
||||||
m_tables.clear();
|
m_tables.clear();
|
||||||
for (const auto &e : *classes) {
|
for (const auto &e : *classes) {
|
||||||
bool add = false;
|
bool add = false;
|
||||||
if (e.kind == RelKind::Table) {
|
if (e.kind == RelKind::Table || e.kind == RelKind::View
|
||||||
|
|| e.kind == RelKind::MaterializedView || e.kind == RelKind::ForeignTable) {
|
||||||
switch (m_namespaceFilter) {
|
switch (m_namespaceFilter) {
|
||||||
case TablesTableModel::User:
|
case TablesTableModel::User:
|
||||||
add = !e.ns().isSystemCatalog();
|
add = !e.ns().isSystemCatalog();
|
||||||
|
|
@ -121,6 +122,7 @@ QVariant TablesTableModel::headerData(int section, Qt::Orientation orientation,
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case NameCol: return tr("Name");
|
case NameCol: return tr("Name");
|
||||||
case NamespaceCol: return tr("Schema");
|
case NamespaceCol: return tr("Schema");
|
||||||
|
case KindCol: return tr("Kind");
|
||||||
case OwnerCol: return tr("Owner");
|
case OwnerCol: return tr("Owner");
|
||||||
case TablespaceCol: return tr("Tablespace");
|
case TablespaceCol: return tr("Tablespace");
|
||||||
case OptionsCol: return tr("Options");
|
case OptionsCol: return tr("Options");
|
||||||
|
|
@ -150,6 +152,7 @@ Oid TablesTableModel::getType(int column) const
|
||||||
case OwnerCol:
|
case OwnerCol:
|
||||||
case NameCol:
|
case NameCol:
|
||||||
case NamespaceCol:
|
case NamespaceCol:
|
||||||
|
case KindCol:
|
||||||
case OptionsCol:
|
case OptionsCol:
|
||||||
case AclCol:
|
case AclCol:
|
||||||
default:
|
default:
|
||||||
|
|
@ -164,6 +167,7 @@ QVariant TablesTableModel::getData(const QModelIndex &index) const
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case NameCol: return t.objectName();
|
case NameCol: return t.objectName();
|
||||||
case NamespaceCol: return t.nsName();
|
case NamespaceCol: return t.nsName();
|
||||||
|
case KindCol: return t.typeName();
|
||||||
case OwnerCol: return t.ownerName();
|
case OwnerCol: return t.ownerName();
|
||||||
case TablespaceCol: return getTablespaceDisplayString(*m_catalog, t.tablespace);
|
case TablespaceCol: return getTablespaceDisplayString(*m_catalog, t.tablespace);
|
||||||
case OptionsCol: break;
|
case OptionsCol: break;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ public:
|
||||||
enum e_Columns : int {
|
enum e_Columns : int {
|
||||||
NameCol, ///< either table, ns.table or table (ns) depending on settings/filters
|
NameCol, ///< either table, ns.table or table (ns) depending on settings/filters
|
||||||
NamespaceCol,
|
NamespaceCol,
|
||||||
|
KindCol,
|
||||||
OwnerCol,
|
OwnerCol,
|
||||||
TablespaceCol,
|
TablespaceCol,
|
||||||
OptionsCol,
|
OptionsCol,
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ public:
|
||||||
// bool operator<(Oid _oid) const { return oid < _oid; }
|
// bool operator<(Oid _oid) const { return oid < _oid; }
|
||||||
// bool operator<(const PgClass &rhs) const { return oid < rhs.oid; }
|
// bool operator<(const PgClass &rhs) const { return oid < rhs.oid; }
|
||||||
|
|
||||||
|
QString kindString() const;
|
||||||
QString createSql() const;
|
QString createSql() const;
|
||||||
QString typeName() const override;
|
QString typeName() const override;
|
||||||
QString aclAllPattern() const override;
|
QString aclAllPattern() const override;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ std::string PgClassContainer::getLoadQuery() const
|
||||||
" relkind, relhasoids, relispopulated, relfrozenxid, relminmxid, "
|
" relkind, relhasoids, relispopulated, relfrozenxid, relminmxid, "
|
||||||
" reloptions, relacl \n"
|
" reloptions, relacl \n"
|
||||||
"FROM pg_catalog.pg_class \n"
|
"FROM pg_catalog.pg_class \n"
|
||||||
"WHERE relkind IN ('r', 'i', 'p', 'I')";
|
"WHERE relkind IN ('r', 'i', 'p', 'I', 'v', 'm', 'f')";
|
||||||
}
|
}
|
||||||
|
|
||||||
PgClass PgClassContainer::loadElem(const Pgsql::Row &row)
|
PgClass PgClassContainer::loadElem(const Pgsql::Row &row)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue