pgLab/pglablib/catalog/PgClass.h

73 lines
1.4 KiB
C
Raw Normal View History

#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);
2018-01-08 20:45:52 +01:00
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;
2018-09-02 10:30:30 +00:00
std::vector<QString> options;
2019-10-26 13:13:58 +02:00
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;
2018-01-08 20:45:52 +01:00
private:
mutable QString createSqlCache;
QString createTableSql() const;
2019-10-26 13:13:58 +02:00
QString createViewSql() const;
};
#endif // PGCLASS_H