Loading of the list of indexes works for version 9.3 (and maybe before if there are no other differences)
This commit is contained in:
parent
c37e9eccb8
commit
8402470baa
1 changed files with 15 additions and 5 deletions
|
|
@ -1,16 +1,22 @@
|
|||
#include "PgIndexContainer.h"
|
||||
#include "PgDatabaseCatalog.h"
|
||||
#include "Pgsql_Col.h"
|
||||
#include <iterator>
|
||||
|
||||
std::string PgIndexContainer::getLoadQuery() const
|
||||
{
|
||||
return R"__(
|
||||
std::string q = R"__(
|
||||
SELECT indexrelid, indrelid, indnatts, indisunique, indisprimary,
|
||||
indisexclusion, indimmediate, indisclustered, indisvalid,
|
||||
indcheckxmin, indisready, indislive, indisreplident, indkey,
|
||||
indcheckxmin, indisready, indislive, indkey,
|
||||
indcollation, indclass, indoption, indexprs, indpred,
|
||||
pg_get_indexdef(indexrelid)
|
||||
FROM pg_index)__";
|
||||
pg_get_indexdef(indexrelid))__";
|
||||
|
||||
auto cat = m_catalogue.lock();
|
||||
if (cat && cat->serverVersion() >= 90400)
|
||||
q += ", indisreplident ";
|
||||
q += "\nFROM pg_index";
|
||||
return q;
|
||||
}
|
||||
|
||||
PgIndex PgIndexContainer::loadElem(const Pgsql::Row &row)
|
||||
|
|
@ -19,12 +25,16 @@ PgIndex PgIndexContainer::loadElem(const Pgsql::Row &row)
|
|||
PgIndex v;
|
||||
col >> v.indexrelid >> v.relid >> v.natts >> v.isunique
|
||||
>> v.isprimary >> v.isexclusion >> v.immediate >> v.isclustered
|
||||
>> v.isvalid >> v.checkxmin >> v.isready >> v.islive >> v.isreplident;
|
||||
>> v.isvalid >> v.checkxmin >> v.isready >> v.islive;
|
||||
col.getAsVector<int16_t>(std::back_inserter(v.key));
|
||||
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 >> v.definition;
|
||||
auto cat = m_catalogue.lock();
|
||||
if (cat && cat->serverVersion() >= 90400)
|
||||
col >> v.isreplident;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue