pg11: pg_proc, type of function is stored differently from pg11 forward

Followed the more structured approach of pg11 in combining the different types into a kind field
when reading from older versions we migrate the old fields to the new field. Change in 11
is because of PROCEDURE support. However full PROCEDURE support will be its own change and is
registered as issue #37
This commit is contained in:
eelke 2018-12-23 08:48:45 +01:00
parent a88af1ac11
commit 43f8117bbd
3 changed files with 60 additions and 9 deletions

View file

@ -25,6 +25,15 @@ public:
};
enum class ProcKind {
Function, // f Normal function
Procedure, // p stored procedure, new in 11 can use transactions executed with CALL
Aggregate, // a
Window // w
};
void operator<<(ProcKind &s, const Pgsql::Value &v);
class PgProc: public PgNamespaceObject, public PgOwnedObject {
public:
using PgNamespaceObject::PgNamespaceObject;
@ -38,8 +47,9 @@ public:
float rows = 0.f; // float4
Oid variadic = InvalidOid; // oid
QString transform; // regproc
bool isagg = false; // bool
bool iswindow = false; // bool
// bool isagg = false; // bool < 11
// bool iswindow = false; // bool << 11
ProcKind kind = ProcKind::Function; // >= 11
bool secdef = false; // bool
bool leakproof = false; // bool
bool isstrict = false; // bool
@ -77,6 +87,11 @@ public:
QString volatility() const;
bool isFunction() const { return kind == ProcKind::Function; }
bool isProcedure() const { return kind == ProcKind::Procedure; }
bool isAggregate() const { return kind == ProcKind::Aggregate; }
bool isWindow() const { return kind == ProcKind::Window; }
// bool isTrigger() const
// {
// return typname == wxT("\"trigger\"") || typname == wxT("trigger") || typname == wxT("event_trigger") || typname == wxT("\"event_trigger\""))