diff --git a/pgadmin/schema/pgView.cpp b/pgadmin/schema/pgView.cpp
index 92c3061..3b62421 100644
--- a/pgadmin/schema/pgView.cpp
+++ b/pgadmin/schema/pgView.cpp
@@ -620,8 +620,7 @@ bool pgView::IsMaterializedView(ctlTree *browser)
 {
 	if (this->GetConnection()->BackendMinimumVersion(9, 3))
 	{
-		wxString sql = wxT("SELECT count(*) FROM pg_matviews WHERE matviewname = ") + qtDbString(this->GetQuotedIdentifier()) + wxT(" AND schemaname = ") + qtDbString(this->GetSchema()->GetQuotedIdentifier());
-
+		wxString sql  = wxString::Format(wxT("SELECT count(*) FROM pg_catalog.pg_class WHERE oid='%ld'::oid AND relkind = 'm'"),(long)(this->GetOid()));
 		if (!this->GetDatabase()->GetConnection() || this->GetDatabase()->ExecuteScalar(sql) == wxT("0"))
 			return false;
 		else
