Added pg_proc table to the catalog. Contains the definition of functions.
Also improved the loading code for some catalog tables.
This commit is contained in:
parent
d8fc14c823
commit
35813ae926
10 changed files with 152 additions and 17 deletions
52
pglablib/PgProcContainer.cpp
Normal file
52
pglablib/PgProcContainer.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#include "PgProcContainer.h"
|
||||
#include "Pgsql_Connection.h"
|
||||
#include "Pgsql_Col.h"
|
||||
#include "PgDatabaseCatalog.h"
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
std::string PgProcContainer::getLoadQuery() const
|
||||
{
|
||||
std::string column_list =
|
||||
"oid,proname,pronamespace,proowner,prolang,procost,prorows,"
|
||||
"provariadic,protransform,proisagg,proiswindow,prosecdef,proleakproof,"
|
||||
"proisstrict,proretset,provolatile,pronargs,pronargdefaults,prorettype,"
|
||||
"proargtypes,proallargtypes,proargmodes,proargnames,proargdefaults,"
|
||||
"prosrc,probin,proconfig,proacl";
|
||||
auto cat = m_catalogue.lock();
|
||||
int ver = cat->serverVersion();
|
||||
if (ver >= 90500) {
|
||||
column_list += ",protrftypes";
|
||||
}
|
||||
else if (cat->serverVersion() >= 90600) {
|
||||
column_list += ",proparallel";
|
||||
}
|
||||
|
||||
return "SELECT " + column_list + " FROM pg_proc";
|
||||
}
|
||||
|
||||
PgProc PgProcContainer::loadElem(const Pgsql::Row &row)
|
||||
{
|
||||
Pgsql::Col col(row);
|
||||
PgProc v;
|
||||
col >> v.oid >> v.proname >> v.pronamespace >> v.proowner >> v.prolang >> v.procost >> v.prorows
|
||||
>> v.provariadic >> v.protransform >> v.proisagg >> v.proiswindow >> v.prosecdef >> v.proleakproof
|
||||
>> v.proisstrict >> v.proretset >> v.provolatile >> v.pronargs >> v.pronargdefaults
|
||||
>> v.prorettype;
|
||||
col.getAsVector<Oid>(std::back_inserter(v.proargtypes));
|
||||
col >> v.proallargtypes >> v.proargmodes >> v.proargnames
|
||||
>> v.proargdefaults;
|
||||
col >> v.prosrc;
|
||||
col >> v.probin >> v.proconfig >> v.proacl;
|
||||
|
||||
auto cat = m_catalogue.lock();
|
||||
int ver = cat->serverVersion();
|
||||
if (ver >= 90500) {
|
||||
col >> v.protrftypes;
|
||||
}
|
||||
else if (cat->serverVersion() >= 90600) {
|
||||
col >> v.proparallel;
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue