pgLab/pglablib/catalog/PgClass.h
eelke 11459e1e12 Show sizes
table, index, toast and total size per Table
size of each index
2021-03-10 19:06:40 +01:00

72 lines
1.4 KiB
C++

#ifndef PGCLASS_H
#define PGCLASS_H
#include "Pgsql_Value.h"
#include "PgNamespaceObject.h"
#include <QString>
#include <libpq-fe.h>
enum class RelPersistence {
Permanent, // p
Unlogged, // u
Temporary // t
};
void operator<<(RelPersistence &s, const Pgsql::Value &v);
enum class RelKind {
Table, // r
Index, // i
Sequence, // S
View, // v
MaterializedView, // m
Composite, // c
Toast, // t
ForeignTable // f
};
void operator<<(RelKind &s, const Pgsql::Value &v);
class PgClass: public PgNamespaceObject {
public:
Oid type = InvalidOid;
Oid oftype = InvalidOid;
//Oid owner = InvalidOid;
Oid am = InvalidOid;
Oid filenode = InvalidOid;
Oid tablespace = InvalidOid;
int32_t pages_est = 0;
float tuples_est = 0.0f;
Oid toastrelid = InvalidOid;
bool isshared = false;
RelPersistence persistence;
RelKind kind;
bool hasoids = false;
bool ispopulated;
int frozenxid;
int minmxid;
std::vector<QString> options;
QString viewdef;
QString description; // from pg_description
int64_t totalBytes;
int64_t indexBytes;
int64_t toastBytes;
using PgNamespaceObject::PgNamespaceObject;
QString kindString() const;
QString createSql() const override;
QString typeName() const override;
QString aclAllPattern() const override;
private:
mutable QString createSqlCache;
QString createTableSql() const;
QString createViewSql() const;
};
#endif // PGCLASS_H