In the list of columns displayed for a table a set of columns is appended describing the indexes on the table.

This commit is contained in:
eelke 2017-12-17 19:34:28 +01:00
parent aef9b914b1
commit 172e2bcd1d
9 changed files with 95 additions and 43 deletions

View file

@ -8,7 +8,8 @@ std::string PgIndexContainer::getLoadQuery() const
SELECT indexrelid, indrelid, indnatts, indisunique, indisprimary,
indisexclusion, indimmediate, indisclustered, indisvalid,
indcheckxmin, indisready, indislive, indisreplident, indkey,
indcollation, indclass, indoption, indexprs, indpred
indcollation, indclass, indoption, indexprs, indpred,
pg_get_indexdef(indexrelid)
FROM pg_index)__";
}
@ -23,6 +24,16 @@ PgIndex PgIndexContainer::loadElem(const Pgsql::Row &row)
col.getAsVector<Oid>(std::back_inserter(v.collation));
col.getAsVector<Oid>(std::back_inserter(v.indclass));
col.getAsVector<int16_t>(std::back_inserter(v.option));
col >> v.exprs >> v.pred;
col >> v.exprs >> v.pred >> v.definition;
return v;
}
std::vector<PgIndex> PgIndexContainer::getIndexesForTable(Oid table_oid) const
{
std::vector<PgIndex> result;
for (const auto &e : m_container)
if (e.relid == table_oid)
result.push_back(e);
return result;
}