mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-21 06:45:27 -06:00
Add index btree check
Добавлена проверка индекса функций bt_index_parent_check(regclass,true) Вызывается из контекстного меню.
This commit is contained in:
parent
21a368457a
commit
b5e10e967a
5 changed files with 43 additions and 1 deletions
|
|
@ -547,7 +547,7 @@ bool pgConn::HasFeature(int featureNo, bool forceCheck)
|
||||||
wxT(" JOIN pg_namespace n ON n.oid=pronamespace\n")
|
wxT(" JOIN pg_namespace n ON n.oid=pronamespace\n")
|
||||||
wxT(" WHERE proname IN ('pg_tablespace_size', 'pg_file_read', 'pg_logfile_rotate',")
|
wxT(" WHERE proname IN ('pg_tablespace_size', 'pg_file_read', 'pg_logfile_rotate',")
|
||||||
wxT( " 'pg_postmaster_starttime', 'pg_terminate_backend', 'pg_reload_conf',")
|
wxT( " 'pg_postmaster_starttime', 'pg_terminate_backend', 'pg_reload_conf',")
|
||||||
wxT( " 'pgstattuple', 'pgstatindex')\n")
|
wxT( " 'pgstattuple', 'pgstatindex','bt_index_parent_check')\n")
|
||||||
wxT(" AND nspname IN ('pg_catalog', 'public')");
|
wxT(" AND nspname IN ('pg_catalog', 'public')");
|
||||||
|
|
||||||
pgSet *set = ExecuteSet(sql);
|
pgSet *set = ExecuteSet(sql);
|
||||||
|
|
@ -577,6 +577,8 @@ bool pgConn::HasFeature(int featureNo, bool forceCheck)
|
||||||
features[FEATURE_PGSTATTUPLE] = true;
|
features[FEATURE_PGSTATTUPLE] = true;
|
||||||
else if (proname == wxT("pgstatindex") && pronargs == 1 && set->GetLong(wxT("arg0")) == 25)
|
else if (proname == wxT("pgstatindex") && pronargs == 1 && set->GetLong(wxT("arg0")) == 25)
|
||||||
features[FEATURE_PGSTATINDEX] = true;
|
features[FEATURE_PGSTATINDEX] = true;
|
||||||
|
else if (proname == wxT("bt_index_parent_check") && pronargs == 2 )
|
||||||
|
features[FEATURE_PGCHECKINDEX] = true;
|
||||||
|
|
||||||
set->MoveNext();
|
set->MoveNext();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -315,6 +315,7 @@ void frmMain::CreateMenus()
|
||||||
new refreshConcurrentlyMatViewFactory(menuFactories, viewMenu, 0);
|
new refreshConcurrentlyMatViewFactory(menuFactories, viewMenu, 0);
|
||||||
new executePgstattupleFactory(menuFactories, viewMenu, 0);
|
new executePgstattupleFactory(menuFactories, viewMenu, 0);
|
||||||
new executePgstatindexFactory(menuFactories, viewMenu, 0);
|
new executePgstatindexFactory(menuFactories, viewMenu, 0);
|
||||||
|
new executePgcheckindexFactory(menuFactories, viewMenu, 0);
|
||||||
new enabledisableRuleFactory(menuFactories, toolsMenu, 0);
|
new enabledisableRuleFactory(menuFactories, toolsMenu, 0);
|
||||||
new enabledisableTriggerFactory(menuFactories, toolsMenu, 0);
|
new enabledisableTriggerFactory(menuFactories, toolsMenu, 0);
|
||||||
new enabledisableEventTriggerFactory(menuFactories, toolsMenu, 0);
|
new enabledisableEventTriggerFactory(menuFactories, toolsMenu, 0);
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,7 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool HasPgstatindex();
|
bool HasPgstatindex();
|
||||||
|
bool HasPgcheckindex();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ReadColumnDetails();
|
void ReadColumnDetails();
|
||||||
|
|
@ -345,6 +346,13 @@ public:
|
||||||
bool CheckEnable(pgObject *obj);
|
bool CheckEnable(pgObject *obj);
|
||||||
bool CheckChecked(pgObject *obj);
|
bool CheckChecked(pgObject *obj);
|
||||||
};
|
};
|
||||||
|
class executePgcheckindexFactory : public contextActionFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
executePgcheckindexFactory(menuFactoryList* list, wxMenu* mnu, ctlMenuToolbar* toolbar);
|
||||||
|
wxWindow* StartDialog(frmMain* form, pgObject* obj);
|
||||||
|
bool CheckEnable(pgObject* obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ enum
|
||||||
FEATURE_RELOAD_CONF,
|
FEATURE_RELOAD_CONF,
|
||||||
FEATURE_PGSTATTUPLE,
|
FEATURE_PGSTATTUPLE,
|
||||||
FEATURE_PGSTATINDEX,
|
FEATURE_PGSTATINDEX,
|
||||||
|
FEATURE_PGCHECKINDEX,
|
||||||
FEATURE_FUNCTION_DEFAULTS,
|
FEATURE_FUNCTION_DEFAULTS,
|
||||||
FEATURE_LAST
|
FEATURE_LAST
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -473,6 +473,36 @@ bool pgIndexBase::HasPgstatindex()
|
||||||
return GetConnection()->HasFeature(FEATURE_PGSTATINDEX);
|
return GetConnection()->HasFeature(FEATURE_PGSTATINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pgIndexBase::HasPgcheckindex()
|
||||||
|
{
|
||||||
|
return GetConnection()->HasFeature(FEATURE_PGCHECKINDEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
executePgcheckindexFactory::executePgcheckindexFactory(menuFactoryList* list, wxMenu* mnu, ctlMenuToolbar* toolbar) : contextActionFactory(list)
|
||||||
|
{
|
||||||
|
mnu->Append(id, _("Check Btree index"), _("Check Btree index function bt_index_parent_check(oid,true)"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxWindow* executePgcheckindexFactory::StartDialog(frmMain* form, pgObject* obj)
|
||||||
|
{
|
||||||
|
pgIndexBase* i = (pgIndexBase*)obj;
|
||||||
|
form->StartMsg(_("Check Btree index "+i->GetName()+" "));
|
||||||
|
wxString sql = "SELECT bt_index_parent_check("+i->GetOidStr()+",true);";
|
||||||
|
i->GetConnection()->ExecuteVoid(sql);
|
||||||
|
form->EndMsg(true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool executePgcheckindexFactory::CheckEnable(pgObject* obj)
|
||||||
|
{
|
||||||
|
|
||||||
|
return obj &&
|
||||||
|
(obj->IsCreatedBy(indexFactory) || obj->IsCreatedBy(primaryKeyFactory)
|
||||||
|
|| obj->IsCreatedBy(uniqueFactory) || obj->IsCreatedBy(excludeFactory)) && ((pgIndexBase*)obj)->GetIndexType()=="btree" &&
|
||||||
|
((pgIndexBase*)obj)->HasPgcheckindex();
|
||||||
|
}
|
||||||
|
|
||||||
executePgstatindexFactory::executePgstatindexFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar) : contextActionFactory(list)
|
executePgstatindexFactory::executePgstatindexFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar) : contextActionFactory(list)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue