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:
parent
a88af1ac11
commit
43f8117bbd
3 changed files with 60 additions and 9 deletions
|
|
@ -9,16 +9,18 @@ std::string PgProcContainer::getLoadQuery() const
|
|||
{
|
||||
std::string column_list =
|
||||
"oid,proname,pronamespace,proowner,prolang,procost,prorows,"
|
||||
"provariadic,protransform,proisagg,proiswindow,prosecdef,proleakproof,"
|
||||
"provariadic,protransform,prosecdef,proleakproof,"
|
||||
"proisstrict,proretset,provolatile,pronargs,pronargdefaults,prorettype,"
|
||||
"proargtypes,proallargtypes,proargmodes,proargnames,proargdefaults,"
|
||||
"prosrc,probin,proconfig,proacl";
|
||||
if (minimumVersion(90500)) {
|
||||
if (minimumVersion(90500))
|
||||
column_list += ",protrftypes";
|
||||
}
|
||||
if (minimumVersion(90600)) {
|
||||
if (minimumVersion(90600))
|
||||
column_list += ",proparallel";
|
||||
}
|
||||
if (minimumVersion(110000))
|
||||
column_list += ",prokind";
|
||||
else
|
||||
column_list += ",proisagg,proiswindow";
|
||||
|
||||
return "SELECT " + column_list + " FROM pg_proc";
|
||||
}
|
||||
|
|
@ -31,10 +33,12 @@ PgProc PgProcContainer::loadElem(const Pgsql::Row &row)
|
|||
Oid namespace_oid = col.nextValue();
|
||||
Oid owner_oid = col.nextValue();
|
||||
|
||||
//ProcKind
|
||||
|
||||
PgProc v(m_catalog, oid, name, namespace_oid);
|
||||
v.setOwnerOid(m_catalog, owner_oid);
|
||||
col >> v.lang >> v.cost >> v.rows
|
||||
>> v.variadic >> v.transform >> v.isagg >> v.iswindow >> v.secdef >> v.leakproof
|
||||
>> v.variadic >> v.transform >> v.secdef >> v.leakproof
|
||||
>> v.isstrict >> v.retset >> v.provolatile >> v.nargs >> v.nargdefaults
|
||||
>> v.rettype;
|
||||
|
||||
|
|
@ -55,6 +59,20 @@ PgProc PgProcContainer::loadElem(const Pgsql::Row &row)
|
|||
if (minimumVersion(90600)) {
|
||||
col >> v.parallel;
|
||||
}
|
||||
if (minimumVersion(110000))
|
||||
col >> v.kind;
|
||||
else {
|
||||
bool agg, window;
|
||||
col >> agg >> window;
|
||||
if (agg)
|
||||
v.kind = ProcKind::Aggregate;
|
||||
else if (window)
|
||||
v.kind = ProcKind::Window;
|
||||
else {
|
||||
v.kind = ProcKind::Function;
|
||||
}
|
||||
// Only 11 and higher has ProcKind::Procedure!
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue