diff --git a/pgadmin/dlg/dlgView.cpp b/pgadmin/dlg/dlgView.cpp
index 66606b9..6697493 100644
--- a/pgadmin/dlg/dlgView.cpp
+++ b/pgadmin/dlg/dlgView.cpp
@@ -169,15 +169,16 @@ int dlgView::Go(bool modal)
if ((connection->BackendMinimumVersion(9, 3) && view))
{
- // While editing the view, if it is materialized view then only change
+ // If it is materialized view than edit it
if (view->IsMaterializedView(view->GetSchema()->GetName(), view->GetName()))
{
- // It is materialied view while editing the view so check the box accordingly
+ // Checked the view as user is in edit materialized view mode
chkMaterializedView->SetValue(true);
// Disable the security barrie as user is editing the materailized view
chkSecurityBarrier->Disable();
- // It is materialized view not allow user to go to normal view
+
+ // Disable the materialized view as user is editing it and not allowed to switch to other view
chkMaterializedView->Disable();
if (view->GetTablespaceOid() != 0)
diff --git a/pgadmin/include/images/module.mk b/pgadmin/include/images/module.mk
index 0fe12cf..a7670eb 100644
--- a/pgadmin/include/images/module.mk
+++ b/pgadmin/include/images/module.mk
@@ -189,6 +189,8 @@ pgadmin3_SOURCES += \
include/images/language.png \
include/images/languages.png \
include/images/loginroles.png \
+ include/images/mview.png \
+ include/images/mview-sm.png \
include/images/namespace-sm.png \
include/images/namespace.png \
include/images/namespaces.png \
diff --git a/pgadmin/include/schema/pgView.h b/pgadmin/include/schema/pgView.h
index 281f68b..13b9369 100644
--- a/pgadmin/include/schema/pgView.h
+++ b/pgadmin/include/schema/pgView.h
@@ -23,6 +23,14 @@ public:
virtual dlgProperty *CreateDialog(frmMain *frame, pgObject *node, pgObject *parent);
virtual pgObject *CreateObjects(pgCollection *obj, ctlTree *browser, const wxString &restr = wxEmptyString);
virtual pgCollection *CreateCollection(pgObject *obj);
+ int GetMaterializedIconId()
+ {
+ return WantSmallIcon() ? smallMaterializedId : materializedId;
+ }
+
+protected:
+ int materializedId, smallMaterializedId;
+
};
extern pgViewFactory viewFactory;
@@ -33,6 +41,8 @@ public:
pgView(pgSchema *newSchema, const wxString &newName = wxT(""));
~pgView();
+ int GetIconId();
+
wxString GetTranslatedMessage(int kindOfMessage) const;
void ShowTreeDetail(ctlTree *browser, frmMain *form = 0, ctlListView *properties = 0, ctlSQLBox *sqlPane = 0);
bool CanDropCascaded()
diff --git a/pgadmin/pgAdmin3.vcxproj b/pgadmin/pgAdmin3.vcxproj
index 2b5566d..0414e5f 100644
--- a/pgadmin/pgAdmin3.vcxproj
+++ b/pgadmin/pgAdmin3.vcxproj
@@ -3408,6 +3408,8 @@
+
+
diff --git a/pgadmin/pgAdmin3.vcxproj.filters b/pgadmin/pgAdmin3.vcxproj.filters
index 1fc4929..42c731a 100644
--- a/pgadmin/pgAdmin3.vcxproj.filters
+++ b/pgadmin/pgAdmin3.vcxproj.filters
@@ -4097,6 +4097,12 @@
include\images
+
+ include\images
+
+
+ include\images
+
include\images
diff --git a/pgadmin/schema/pgView.cpp b/pgadmin/schema/pgView.cpp
index 113c782..ac14381 100644
--- a/pgadmin/schema/pgView.cpp
+++ b/pgadmin/schema/pgView.cpp
@@ -646,6 +646,14 @@ bool pgView::IsMaterializedView(wxString schemaName, wxString viewName)
return false;
}
+int pgView::GetIconId()
+{
+ if (IsMaterializedView(this->GetSchema()->GetName(),this->GetName()))
+ return viewFactory.GetMaterializedIconId();
+ else
+ return viewFactory.GetIconId();
+}
+
///////////////////////////////////////////////////
@@ -689,7 +697,7 @@ pgObject *pgViewFactory::CreateObjects(pgCollection *collection, ctlTree *browse
if (collection->GetDatabase()->BackendMinimumVersion(9, 3))
{
- sql = wxT("SELECT c.oid, c.xmin, c.relname,c.reltablespace AS spcoid,c.relispopulated AS ispopulated,spc.spcname, pg_get_userbyid(c.relowner) AS viewowner, c.relacl, description, ")
+ sql = wxT("SELECT c.oid, c.xmin, c.relname,c.reltablespace AS spcoid, c.relkind, c.relispopulated AS ispopulated,spc.spcname, pg_get_userbyid(c.relowner) AS viewowner, c.relacl, description, ")
wxT("pg_get_viewdef(c.oid") + collection->GetDatabase()->GetPrettyOption() + wxT(") AS definition");
}
else
@@ -709,10 +717,9 @@ pgObject *pgViewFactory::CreateObjects(pgCollection *collection, ctlTree *browse
}
if (collection->GetConnection()->BackendMinimumVersion(9, 3))
+ {
sql += wxT(", substring(array_to_string(c.reloptions, ',') FROM 'fillfactor=([0-9]*)') AS fillfactor \n");
- if (collection->GetConnection()->BackendMinimumVersion(9, 3))
- {
sql += wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') AS autovacuum_enabled \n")
wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold \n")
wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor \n")
@@ -845,6 +852,9 @@ pgObject *pgViewFactory::CreateObjects(pgCollection *collection, ctlTree *browse
if (browser)
{
collection->AppendBrowserItem(browser, view);
+ // If it is materialized view then display the materialized view icon
+ if (collection->GetConnection()->BackendMinimumVersion(9, 3) && views->GetVal(wxT("relkind")).Cmp(wxT("m")) == 0)
+ browser->SetItemImage(view->GetId(),viewFactory.GetMaterializedIconId());
views->MoveNext();
}
else
@@ -860,11 +870,15 @@ pgObject *pgViewFactory::CreateObjects(pgCollection *collection, ctlTree *browse
#include "images/view.pngc"
#include "images/view-sm.pngc"
#include "images/views.pngc"
+#include "images/mview.pngc"
+#include "images/mview-sm.pngc"
pgViewFactory::pgViewFactory()
: pgSchemaObjFactory(__("View"), __("New View..."), __("Create a new View."), view_png_img, view_sm_png_img)
{
metaType = PGM_VIEW;
+ materializedId = addIcon(mview_png_img);
+ smallMaterializedId = addIcon(mview_sm_png_img);
}