mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-15 14:15:49 -06:00
add CREATE STATISTICS
add create statistics pgpro_scheduler correct array comands
This commit is contained in:
parent
3f85d7710f
commit
7bb2f8bcc7
5 changed files with 33 additions and 3 deletions
|
|
@ -91,6 +91,10 @@ This text Russian language.
|
|||
Особенности: SQL текст создания последовательностей игнорируется, секции таблиц не учитываются. Полность одинаковые объекты скрываются. Служебные объекты игнорируются.
|
||||
- выполнен переход на новые библиотеки dll wxWidgets 3.0.4 скомпилированные под VS2012. Необходимо обновить файлы *.dll
|
||||
|
||||
04.03.2020
|
||||
- добавлен вывод CREATE STATISTICS для таблиц
|
||||
* исправлен вывод SQL команды для создания задания для комманд заданных в виде массива
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -336,6 +336,15 @@ public:
|
|||
{
|
||||
partexp = s;
|
||||
}
|
||||
void iSetStatExt(const wxString &s)
|
||||
{
|
||||
statext = s;
|
||||
}
|
||||
wxString GetStatExt()
|
||||
{
|
||||
return statext;
|
||||
}
|
||||
|
||||
bool GetIsPartitioned() const
|
||||
{
|
||||
return isPartitioned || partitionDef.Length() > 0;
|
||||
|
|
@ -584,6 +593,7 @@ private:
|
|||
wxString partkeydef; // partition feature 10 version
|
||||
wxString partexp; // partition feature 10 version
|
||||
wxString partitionDef;
|
||||
wxString statext;
|
||||
bool isPartitioned;
|
||||
bool hasOids, unlogged, hasSubclass, rowsCounted, isReplicated, showExtendedStatistics, distributionIsRandom;
|
||||
|
||||
|
|
|
|||
|
|
@ -209,8 +209,9 @@ pgObject *pgproJobFactory::CreateObjects(pgCollection *collection, ctlTree *brow
|
|||
|
||||
wxString tmp;
|
||||
tmp = jobs->GetVal(wxT("commands"));
|
||||
tmp.Replace(wxT("{"), wxT(""));
|
||||
tmp.Replace(wxT("}"), wxT(""));
|
||||
if (tmp.find('{',0)==0) { tmp=wxT("[")+tmp.Mid(1,tmp.Len()-2)+wxT("]"); }
|
||||
//tmp.Replace(wxT("{"), wxT("["),false);
|
||||
//tmp.Replace(wxT("}"), wxT("]"));
|
||||
|
||||
|
||||
job->iSetCommands(tmp);
|
||||
|
|
|
|||
|
|
@ -696,7 +696,8 @@ wxString pgTable::GetSql(ctlTree *browser)
|
|||
sql += GetGrant(wxT("arwdxt"));
|
||||
else
|
||||
sql += GetGrant(wxT("arwdRxt"));
|
||||
|
||||
wxString st=GetStatExt();
|
||||
if (!st.IsEmpty()) sql += st + wxT(";\n");
|
||||
sql += GetCommentSql();
|
||||
|
||||
if (GetConnection()->BackendMinimumVersion(9, 1))
|
||||
|
|
@ -1531,7 +1532,13 @@ pgObject *pgTableFactory::CreateObjects(pgCollection *collection, ctlTree *brows
|
|||
pg10=wxT("(rel.relpartbound is null and i.inhrelid is null) and");
|
||||
//query += wxT(",\n(SELECT array_agg(provider) FROM pg_seclabels sl2 WHERE sl2.objoid=rel.oid AND sl2.objsubid=0) AS providers");
|
||||
}
|
||||
// 'ALTER STATISTICS '||substring('CREATE STATISTICS public.tab_a (dependencies) ON c1, c3 FROM a' from 'ICS (.+?)\s\(')||' OWNER TO '||
|
||||
//select relation from pg_locks where locktype='relation' and granted=true and mode='AccessExclusiveLock'
|
||||
if (collection->GetDatabase()->BackendMinimumVersion(10, 0))
|
||||
{
|
||||
query += wxT(",\n pg_get_statisticsobjdef(stat_ext.oid) AS stat_stmt");
|
||||
query += wxT(",\nCASE WHEN stat_ext.stxowner<>rel.relowner then 'ALTER STATISTICS '||substring(pg_get_statisticsobjdef(stat_ext.oid) from 'ICS (.+?)\\s\\(')||' OWNER TO '||stat_ext.stxowner::regrole else null end AS alter_stmt");
|
||||
}
|
||||
query += wxT(" FROM pg_class rel\n")
|
||||
wxT(" LEFT JOIN pg_locks lk ON locktype='relation' and granted=true and mode='AccessExclusiveLock' and relation=rel.oid\n")
|
||||
wxT(" LEFT OUTER JOIN pg_tablespace spc on spc.oid=rel.reltablespace\n")
|
||||
|
|
@ -1548,6 +1555,8 @@ pgObject *pgTableFactory::CreateObjects(pgCollection *collection, ctlTree *brows
|
|||
|
||||
if (collection->GetConnection()->BackendMinimumVersion(9, 0))
|
||||
query += wxT("LEFT JOIN pg_type typ ON rel.reloftype=typ.oid\n");
|
||||
if (collection->GetConnection()->BackendMinimumVersion(10, 0))
|
||||
query += wxT("LEFT JOIN pg_statistic_ext stat_ext ON rel.oid=stat_ext.stxrelid\n");
|
||||
|
||||
query += wxT(" WHERE ")+pg10+wxT(" rel.relkind IN ('r','s','t','p') AND rel.relnamespace = ") + collection->GetSchema()->GetOidStr() + wxT("\n");
|
||||
|
||||
|
|
@ -1624,6 +1633,7 @@ pgObject *pgTableFactory::CreateObjects(pgCollection *collection, ctlTree *brows
|
|||
{
|
||||
table->iSetFillFactor(tables->GetVal(wxT("fillfactor")));
|
||||
}
|
||||
|
||||
if (collection->GetConnection()->BackendMinimumVersion(8, 4))
|
||||
{
|
||||
table->iSetRelOptions(tables->GetVal(wxT("reloptions")));
|
||||
|
|
@ -1684,6 +1694,11 @@ pgObject *pgTableFactory::CreateObjects(pgCollection *collection, ctlTree *brows
|
|||
table->iSetPartKeyDef(tables->GetVal(wxT("partkeydef")));
|
||||
table->iSetPartExp(tables->GetVal(wxT("partexp")));
|
||||
table->iSetIsPartitioned(tables->GetBool(wxT("ispartitioned")));
|
||||
wxString st = tables->GetVal(wxT("stat_stmt"));
|
||||
wxString at = tables->GetVal(wxT("alter_stmt"));
|
||||
if (!st.IsEmpty()&&!at.IsEmpty()) st=st+wxT(";\n")+at;
|
||||
table->iSetStatExt(st);
|
||||
|
||||
}
|
||||
if (collection->GetConnection()->GetIsGreenplum())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue