On the list of indexes of a table show which were created as part of the creation of a constraint

The explicit column is true when the index was manually created
In SQL only a comment is given that the index was implicitly created
This commit is contained in:
eelke 2021-04-11 07:56:37 +02:00
parent 60bbb4c445
commit fd5ad9bbf0
6 changed files with 56 additions and 20 deletions

View file

@ -57,9 +57,6 @@ std::vector<PgConstraint> PgConstraintContainer::getFKeyForTableColumn(Oid relid
std::vector<PgConstraint> PgConstraintContainer::getConstraintsForRelation(Oid relid) const
{
std::vector<PgConstraint> result;
// for (const auto &e : m_container)
// if (e.relid == relid)
// result.push_back(e);
std::copy_if(m_container.begin(), m_container.end(), std::back_inserter(result),
[relid] (auto && item) { return item.relid == relid; });
return result;
@ -80,10 +77,15 @@ std::optional<PgConstraint> PgConstraintContainer::getPrimaryForRelation(Oid rel
std::vector<PgConstraint> PgConstraintContainer::getReferencedForRelation(Oid relid) const
{
std::vector<PgConstraint> result;
// for (const auto &e : m_container)
// if (e.frelid == relid)
// result.push_back(e);
std::copy_if(m_container.begin(), m_container.end(), std::back_inserter(result),
std::copy_if(m_container.begin(), m_container.end(), std::back_inserter(result),
[relid] (auto && item) { return item.frelid == relid; });
return result;
return result;
}
std::vector<PgConstraint> PgConstraintContainer::getSupportedByIndex(Oid indexrelid) const
{
std::vector<PgConstraint> result;
std::copy_if(m_container.begin(), m_container.end(), std::back_inserter(result),
[indexrelid] (auto && item) { return item.indid == indexrelid; });
return result;
}