Don't read relhasoids on version 12. Also don't try to select data we are not allowed to read.

This commit is contained in:
eelke 2019-08-10 18:12:26 +02:00
parent 1c48b1945c
commit 5494e5076b
3 changed files with 51 additions and 25 deletions

View file

@ -7,13 +7,20 @@
std::string PgClassContainer::getLoadQuery() const
{
return "SELECT oid, relname, relnamespace, reltype, reloftype, "
std::string q = "SELECT oid, relname, relnamespace, reltype, reloftype, "
" relowner, relam, relfilenode, reltablespace, relpages, "
" reltuples, reltoastrelid, relisshared, relpersistence, "
" relkind, relhasoids, relispopulated, relfrozenxid, relminmxid, "
" reloptions, relacl \n"
"FROM pg_catalog.pg_class \n"
" relkind, relispopulated, relfrozenxid, relminmxid, "
" reloptions, relacl";
if (lessThenVersion(120000))
q += ", relhasoids ";
q +=
"\nFROM pg_catalog.pg_class \n"
"WHERE relkind IN ('r', 'i', 'p', 'I', 'v', 'm', 'f')";
return q;
}
PgClass PgClassContainer::loadElem(const Pgsql::Row &row)
@ -28,13 +35,18 @@ PgClass PgClassContainer::loadElem(const Pgsql::Row &row)
col >> v.type >> v.oftype
>> owner >> v.am >> v.filenode >> v.tablespace >> v.pages_est
>> v.tuples_est >> v.toastrelid >> v.isshared >> v.persistence
>> v.kind >> v.hasoids >> v.ispopulated >> v.frozenxid >> v.minmxid
>> v.kind >> v.ispopulated >> v.frozenxid >> v.minmxid
>> v.options;
v.setOwnerOid(owner);
AclList acl_list;
col >> acl_list;
v.setAcls(std::move(acl_list));
if (lessThenVersion(120000))
col >> v.hasoids;
return v;
}