diff --git a/pgadmin/dlg/dlgForeignDataWrapper.cpp b/pgadmin/dlg/dlgForeignDataWrapper.cpp
new file mode 100644
index 0000000..95912b1
--- /dev/null
+++ b/pgadmin/dlg/dlgForeignDataWrapper.cpp
@@ -0,0 +1,343 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID:      $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// dlgForeignDataWrapper.cpp - PostgreSQL Foreign Data Wrapper Property
+//
+//////////////////////////////////////////////////////////////////////////
+
+// wxWindows headers
+#include <wx/wx.h>
+
+// App headers
+#include "pgAdmin3.h"
+#include "utils/misc.h"
+#include "utils/pgDefs.h"
+
+#include "dlg/dlgForeignDataWrapper.h"
+#include "schema/pgForeignDataWrapper.h"
+
+
+// pointer to controls
+#define cbValidator     CTRL_COMBOBOX("cbValidator")
+#define lstOptions          CTRL_LISTVIEW("lstOptions")
+#define txtOption           CTRL_TEXT("txtOption")
+#define txtValue            CTRL_TEXT("txtValue")
+#define btnAdd              CTRL_BUTTON("wxID_ADD")
+#define btnRemove           CTRL_BUTTON("wxID_REMOVE")
+
+
+dlgProperty *pgForeignDataWrapperFactory::CreateDialog(frmMain *frame, pgObject *node, pgObject *parent)
+{
+    return new dlgForeignDataWrapper(this, frame, (pgForeignDataWrapper*)node);
+}
+
+
+BEGIN_EVENT_TABLE(dlgForeignDataWrapper, dlgSecurityProperty)
+    EVT_TEXT(XRCID("cbValidator"),                    dlgProperty::OnChange)
+    EVT_COMBOBOX(XRCID("cbValidator"),                dlgProperty::OnChange)
+    EVT_LIST_ITEM_SELECTED(XRCID("lstOptions"), dlgForeignDataWrapper::OnSelChangeOption)
+    EVT_TEXT(XRCID("txtOption"),                dlgForeignDataWrapper::OnChangeOptionName)
+    EVT_BUTTON(wxID_ADD,                        dlgForeignDataWrapper::OnAddOption)
+    EVT_BUTTON(wxID_REMOVE,                     dlgForeignDataWrapper::OnRemoveOption)
+END_EVENT_TABLE();
+
+
+dlgForeignDataWrapper::dlgForeignDataWrapper(pgaFactory *f, frmMain *frame, pgForeignDataWrapper *node)
+: dlgSecurityProperty(f, frame, node, wxT("dlgForeignDataWrapper"), wxT("USAGE"), "U")
+{
+    fdw=node;
+}
+
+
+pgObject *dlgForeignDataWrapper::GetObject()
+{
+    return fdw;
+}
+
+
+int dlgForeignDataWrapper::Go(bool modal)
+{
+    // Fill owner combobox
+    AddGroups();
+    AddUsers(cbOwner);
+
+    // Fill validator combobox
+    cbValidator->Append(wxT(""));
+    pgSet *set=connection->ExecuteSet(
+        wxT("SELECT nspname, proname\n")
+        wxT("  FROM pg_proc p\n")
+        wxT("  JOIN pg_namespace nsp ON nsp.oid=pronamespace\n")
+        wxT(" WHERE proargtypes[0]=") + NumToStr(PGOID_TYPE_TEXT_ARRAY) +
+        wxT(" AND proargtypes[1]=") + NumToStr(PGOID_TYPE_OID));
+    if (set)
+    {
+        while (!set->Eof())
+        {
+            wxString procname = database->GetSchemaPrefix(set->GetVal(wxT("nspname"))) + set->GetVal(wxT("proname"));
+            cbValidator->Append(procname);
+            set->MoveNext();
+        }
+        delete set;
+    }
+    cbValidator->SetSelection(0);
+
+    // Initialize options listview and buttons
+    lstOptions->AddColumn(_("Option"), 80);
+    lstOptions->AddColumn(_("Value"), 40);
+    txtOption->SetValue(wxT(""));
+    txtValue->SetValue(wxT(""));
+    btnAdd->Disable();
+    btnRemove->Disable();
+
+    if (fdw)
+    {
+        // edit mode
+        txtName->Disable();
+        wxString val=fdw->GetValidatorProc();
+        if (!val.IsEmpty())
+        {
+            for (unsigned int i = 0 ; i < cbValidator->GetCount() ; i++)
+            {
+                if (cbValidator->GetString(i) == val)
+                    cbValidator->SetSelection(i);
+            }
+        }
+
+        wxString options = fdw->GetOptions();
+        wxString option, optionname, optionvalue;
+        while (options.Length() > 0)
+        {
+          option = options.BeforeFirst(',');
+          optionname = option.BeforeFirst(wxT('=')).Trim(false).Trim();
+          optionvalue = option.AfterFirst(wxT('=')).Trim(false).Trim();
+          lstOptions->AppendItem(optionname, optionvalue);
+          options = options.AfterFirst(',');
+        }
+    }
+    else
+    {
+        // create mode
+    }
+
+    return dlgSecurityProperty::Go(modal);
+}
+
+
+pgObject *dlgForeignDataWrapper::CreateObject(pgCollection *collection)
+{
+    wxString name=txtName->GetValue();
+
+    pgObject *obj=foreignDataWrapperFactory.CreateObjects(collection, 0, wxT("\n   AND fdwname ILIKE ") + qtDbString(name));
+    return obj;
+}
+
+
+void dlgForeignDataWrapper::CheckChange()
+{
+    bool didChange=true;
+    wxString name=txtName->GetValue();
+    if (fdw)
+    {
+        didChange = name != fdw->GetName()
+          || txtComment->GetValue() != fdw->GetComment()
+          || cbOwner->GetValue() != fdw->GetOwner()
+          || GetOptionsSql().Length() > 0;
+        EnableOK(didChange);
+    }
+    else
+    {
+
+        bool enable=true;
+
+        CheckValid(enable, !name.IsEmpty(), _("Please specify name."));
+        EnableOK(enable);
+    }
+}
+
+
+
+void dlgForeignDataWrapper::OnChangeOptionName(wxCommandEvent &ev)
+{
+    btnAdd->Enable(txtOption->GetValue().Length() > 0);
+}
+
+
+void dlgForeignDataWrapper::OnSelChangeOption(wxListEvent &ev)
+{
+    int row=lstOptions->GetSelection();
+    if (row >= 0)
+    {
+        txtOption->SetValue(lstOptions->GetText(row, 0));
+        txtValue->SetValue(lstOptions->GetText(row, 1));
+    }
+
+    btnRemove->Enable(row >= 0);
+}
+
+
+void dlgForeignDataWrapper::OnAddOption(wxCommandEvent &ev)
+{
+    bool found = false;
+
+    for (int pos = 0 ; pos < lstOptions->GetItemCount() ; pos++)
+    {
+        if (lstOptions->GetText(pos).IsSameAs(txtOption->GetValue(), false))
+        {
+            lstOptions->SetItem(pos, 1, txtValue->GetValue());
+            found = true;
+            break;
+        }
+    }
+
+    if (!found)
+    {
+        lstOptions->AppendItem(txtOption->GetValue(), txtValue->GetValue());
+    }
+
+    txtOption->SetValue(wxT(""));
+    txtValue->SetValue(wxT(""));
+    btnAdd->Disable();
+
+    CheckChange();
+}
+
+
+void dlgForeignDataWrapper::OnRemoveOption(wxCommandEvent &ev)
+{
+    int sel=lstOptions->GetSelection();
+    lstOptions->DeleteItem(sel);
+
+    txtOption->SetValue(wxT(""));
+    txtValue->SetValue(wxT(""));
+    btnRemove->Disable();
+
+    CheckChange();
+}
+
+
+wxString dlgForeignDataWrapper::GetOptionsSql()
+{
+    wxString options = fdw->GetOptions();
+    wxString option, optionname, optionvalue, sqloptions;
+    bool found;
+    int pos;
+
+    while (options.Length() > 0)
+    {
+        option = options.BeforeFirst(',');
+        optionname = option.BeforeFirst(wxT('=')).Trim(false).Trim();
+        optionvalue = option.AfterFirst(wxT('=')).Trim(false).Trim();
+
+        // check for options
+        found = false;
+        for (pos=0 ; pos < lstOptions->GetItemCount() && !found; pos++)
+        {
+            found = lstOptions->GetText(pos, 0).Cmp(optionname) == 0;
+            if (found) break;
+        }
+
+        if (found)
+        {
+            if (lstOptions->GetText(pos, 1).Cmp(optionvalue) != 0)
+            {
+                if (sqloptions.Length() > 0)
+                    sqloptions += wxT(", ");
+                sqloptions += wxT("SET ") + optionname + wxT(" '") + lstOptions->GetText(pos, 1) + wxT("'");
+            }
+        }
+        else
+        {
+            if (sqloptions.Length() > 0)
+                sqloptions += wxT(", ");
+            sqloptions += wxT("DROP ") + optionname;
+        }
+
+        options = options.AfterFirst(',');
+    }
+
+    for (pos=0 ; pos < lstOptions->GetItemCount() ; pos++)
+    {
+        options = fdw->GetOptions();
+        found = false;
+
+        while (options.Length() > 0 && !found)
+        {
+            option = options.BeforeFirst(',');
+            optionname = option.BeforeFirst(wxT('=')).Trim(false).Trim();
+            found = lstOptions->GetText(pos, 0).Cmp(optionname) == 0;
+            options = options.AfterFirst(',');
+        }
+
+        if (!found)
+        {
+            optionvalue = option.AfterFirst(wxT('=')).Trim(false).Trim();
+
+            if (sqloptions.Length() > 0)
+                sqloptions += wxT(", ");
+            sqloptions += wxT("ADD ") + lstOptions->GetText(pos, 0) + wxT(" '") + lstOptions->GetText(pos, 1) + wxT("'");
+        }
+    }
+
+    return sqloptions;
+}
+
+
+wxString dlgForeignDataWrapper::GetSql()
+{
+    wxString sql, name;
+    name=txtName->GetValue();
+
+    if (fdw)
+    {
+        // edit mode
+        if (cbValidator->GetValue() != fdw->GetValidatorProc())
+        {
+            sql = wxT("ALTER FOREIGN DATA WRAPPER ") + qtIdent(name)
+                + wxT("\n   VALIDATOR ") + qtIdent(cbValidator->GetValue()) + wxT(";\n");
+        }
+
+        wxString sqloptions = GetOptionsSql();
+        if (sqloptions.Length() > 0)
+        {
+            sql += wxT("ALTER FOREIGN DATA WRAPPER ") + name
+                 + wxT(" OPTIONS (") + sqloptions + wxT(");\n");
+        }
+
+        AppendOwnerChange(sql, wxT("FOREIGN DATA WRAPPER ") + qtIdent(name));
+    }
+    else
+    {
+        // create mode
+        sql = wxT("CREATE FOREIGN DATA WRAPPER ") + qtIdent(name);
+        AppendIfFilled(sql, wxT("\n   VALIDATOR "), qtIdent(cbValidator->GetValue()));
+
+        // check for options
+        if (lstOptions->GetItemCount() > 0)
+        {
+            wxString options = wxEmptyString;
+            for (int pos=0 ; pos < lstOptions->GetItemCount() ; pos++)
+            {
+                if (options.Length() > 0)
+                    options += wxT(", ");
+
+                options += lstOptions->GetText(pos, 0)
+                    + wxT(" '") + lstOptions->GetText(pos, 1) + wxT("' ");
+            }
+            sql += wxT("\n  OPTIONS (") + options + wxT(")");
+        }
+
+        sql += wxT(";\n");
+        AppendOwnerNew(sql, wxT("FOREIGN DATA WRAPPER ") + qtIdent(name));
+    }
+
+    sql += GetGrant(wxT("U"), wxT("FOREIGN DATA WRAPPER ") + qtIdent(name));
+    AppendComment(sql, wxT("FOREIGN DATA WRAPPER ") + qtIdent(name), 0, fdw);
+
+    return sql;
+}
+
+
diff --git a/pgadmin/dlg/dlgForeignServer.cpp b/pgadmin/dlg/dlgForeignServer.cpp
new file mode 100644
index 0000000..81b1489
--- /dev/null
+++ b/pgadmin/dlg/dlgForeignServer.cpp
@@ -0,0 +1,319 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID:      $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// dlgForeignServer.cpp - PostgreSQL Foreign Server Property
+//
+//////////////////////////////////////////////////////////////////////////
+
+// wxWindows headers
+#include <wx/wx.h>
+
+// App headers
+#include "pgAdmin3.h"
+#include "utils/misc.h"
+#include "utils/pgDefs.h"
+
+#include "dlg/dlgForeignServer.h"
+#include "schema/pgForeignServer.h"
+
+
+// pointer to controls
+#define txtType         CTRL_TEXT("txtType")
+#define txtVersion      CTRL_TEXT("txtVersion")
+#define lstOptions      CTRL_LISTVIEW("lstOptions")
+#define txtOption       CTRL_TEXT("txtOption")
+#define txtValue        CTRL_TEXT("txtValue")
+#define btnAdd          CTRL_BUTTON("wxID_ADD")
+#define btnRemove       CTRL_BUTTON("wxID_REMOVE")
+
+
+dlgProperty *pgForeignServerFactory::CreateDialog(frmMain *frame, pgObject *node, pgObject *parent)
+{
+    return new dlgForeignServer(this, frame, (pgForeignServer*)node);
+}
+
+
+BEGIN_EVENT_TABLE(dlgForeignServer, dlgSecurityProperty)
+    EVT_LIST_ITEM_SELECTED(XRCID("lstOptions"), dlgForeignServer::OnSelChangeOption)
+    EVT_TEXT(XRCID("txtOption"),                dlgForeignServer::OnChangeOptionName)
+    EVT_BUTTON(wxID_ADD,                        dlgForeignServer::OnAddOption)
+    EVT_BUTTON(wxID_REMOVE,                     dlgForeignServer::OnRemoveOption)
+END_EVENT_TABLE();
+
+
+dlgForeignServer::dlgForeignServer(pgaFactory *f, frmMain *frame, pgForeignServer *node)
+: dlgSecurityProperty(f, frame, node, wxT("dlgForeignServer"), wxT("USAGE"), "U")
+{
+    foreignserver=node;
+}
+
+
+pgObject *dlgForeignServer::GetObject()
+{
+    return foreignserver;
+}
+
+
+int dlgForeignServer::Go(bool modal)
+{
+    // Fill owner combobox
+    AddGroups();
+    AddUsers(cbOwner);
+
+    // Initialize options listview and buttons
+    lstOptions->AddColumn(_("Option"), 80);
+    lstOptions->AddColumn(_("Value"), 40);
+    txtOption->SetValue(wxT(""));
+    txtValue->SetValue(wxT(""));
+    btnAdd->Disable();
+    btnRemove->Disable();
+
+    if (foreignserver)
+    {
+        // edit mode
+        txtName->Disable();
+        txtType->Disable();
+
+        txtType->SetValue(foreignserver->GetType());
+        txtVersion->SetValue(foreignserver->GetVersion());
+
+        wxString options = foreignserver->GetOptions();
+        wxString option, optionname, optionvalue;
+        while (options.Length() > 0)
+        {
+          option = options.BeforeFirst(',');
+          optionname = option.BeforeFirst(wxT('=')).Trim(false).Trim();
+          optionvalue = option.AfterFirst(wxT('=')).Trim(false).Trim();
+          lstOptions->AppendItem(optionname, optionvalue);
+          options = options.AfterFirst(',');
+        }
+    }
+    else
+    {
+        // create mode
+    }
+
+    return dlgSecurityProperty::Go(modal);
+}
+
+
+pgObject *dlgForeignServer::CreateObject(pgCollection *collection)
+{
+    wxString name=txtName->GetValue();
+
+    pgObject *obj=foreignDataWrapperFactory.CreateObjects(collection, 0, wxT("\n   AND srvname ILIKE ") + qtDbString(name));
+    return obj;
+}
+
+
+void dlgForeignServer::CheckChange()
+{
+    bool didChange=true;
+    wxString name=txtName->GetValue();
+    if (foreignserver)
+    {
+        didChange = name != foreignserver->GetName()
+          || txtComment->GetValue() != foreignserver->GetComment()
+          || cbOwner->GetValue() != foreignserver->GetOwner()
+          || txtType->GetValue() != foreignserver->GetType()
+          || txtVersion->GetValue() != foreignserver->GetVersion();
+        EnableOK(didChange);
+    }
+    else
+    {
+
+        bool enable=true;
+
+        CheckValid(enable, !name.IsEmpty(), _("Please specify name."));
+        EnableOK(enable);
+    }
+}
+
+
+
+void dlgForeignServer::OnChangeOptionName(wxCommandEvent &ev)
+{
+    btnAdd->Enable(txtOption->GetValue().Length() > 0);
+}
+
+
+void dlgForeignServer::OnSelChangeOption(wxListEvent &ev)
+{
+    int row=lstOptions->GetSelection();
+    if (row >= 0)
+    {
+        txtOption->SetValue(lstOptions->GetText(row, 0));
+        txtValue->SetValue(lstOptions->GetText(row, 1));
+    }
+
+    btnRemove->Enable(row >= 0);
+}
+
+
+void dlgForeignServer::OnAddOption(wxCommandEvent &ev)
+{
+    bool found = false;
+
+    for (int pos = 0 ; pos < lstOptions->GetItemCount() ; pos++)
+    {
+        if (lstOptions->GetText(pos).IsSameAs(txtOption->GetValue(), false))
+        {
+            lstOptions->SetItem(pos, 1, txtValue->GetValue());
+            found = true;
+            break;
+        }
+    }
+
+    if (!found)
+    {
+        lstOptions->AppendItem(txtOption->GetValue(), txtValue->GetValue());
+    }
+
+    txtOption->SetValue(wxT(""));
+    txtValue->SetValue(wxT(""));
+    btnAdd->Disable();
+
+    CheckChange();
+}
+
+
+void dlgForeignServer::OnRemoveOption(wxCommandEvent &ev)
+{
+    int sel=lstOptions->GetSelection();
+    lstOptions->DeleteItem(sel);
+
+    txtOption->SetValue(wxT(""));
+    txtValue->SetValue(wxT(""));
+    btnRemove->Disable();
+
+    CheckChange();
+}
+
+
+wxString dlgForeignServer::GetOptionsSql()
+{
+    wxString options = foreignserver->GetOptions();
+    wxString option, optionname, optionvalue, sqloptions;
+    bool found;
+    int pos;
+
+    while (options.Length() > 0)
+    {
+        option = options.BeforeFirst(',');
+        optionname = option.BeforeFirst(wxT('=')).Trim(false).Trim();
+        optionvalue = option.AfterFirst(wxT('=')).Trim(false).Trim();
+
+        // check for options
+        found = false;
+        for (pos=0 ; pos < lstOptions->GetItemCount() && !found; pos++)
+        {
+            found = lstOptions->GetText(pos, 0).Cmp(optionname) == 0;
+            if (found) break;
+        }
+
+        if (found)
+        {
+            if (lstOptions->GetText(pos, 1).Cmp(optionvalue) != 0)
+            {
+                if (sqloptions.Length() > 0)
+                    sqloptions += wxT(", ");
+                sqloptions += wxT("SET ") + optionname + wxT(" '") + lstOptions->GetText(pos, 1) + wxT("'");
+            }
+        }
+        else
+        {
+            if (sqloptions.Length() > 0)
+                sqloptions += wxT(", ");
+            sqloptions += wxT("DROP ") + optionname;
+        }
+
+        options = options.AfterFirst(',');
+    }
+
+    for (pos=0 ; pos < lstOptions->GetItemCount() ; pos++)
+    {
+        options = foreignserver->GetOptions();
+        found = false;
+
+        while (options.Length() > 0 && !found)
+        {
+            option = options.BeforeFirst(',');
+            optionname = option.BeforeFirst(wxT('=')).Trim(false).Trim();
+            found = lstOptions->GetText(pos, 0).Cmp(optionname) == 0;
+            options = options.AfterFirst(',');
+        }
+
+        if (!found)
+        {
+            optionvalue = option.AfterFirst(wxT('=')).Trim(false).Trim();
+
+            if (sqloptions.Length() > 0)
+                sqloptions += wxT(", ");
+            sqloptions += wxT("ADD ") + lstOptions->GetText(pos, 0) + wxT(" '") + lstOptions->GetText(pos, 1) + wxT("'");
+        }
+    }
+
+    return sqloptions;
+}
+
+
+wxString dlgForeignServer::GetSql()
+{
+    wxString sql, name;
+    name=txtName->GetValue();
+
+    if (foreignserver)
+    {
+        // edit mode
+        if (txtType->GetValue() != foreignserver->GetType())
+        {
+            sql = wxT("ALTER SERVER ") + qtIdent(name)
+                + wxT(" VERSION ") + qtIdent(txtVersion->GetValue()) + wxT(";\n");
+        }
+
+        wxString sqloptions = GetOptionsSql();
+        if (sqloptions.Length() > 0)
+        {
+            sql += wxT("ALTER SERVER ") + name
+                 + wxT(" OPTIONS (") + sqloptions + wxT(");\n");
+        }
+
+        AppendOwnerChange(sql, wxT("FOREIGN DATA WRAPPER ") + qtIdent(name));
+    }
+    else
+    {
+        // create mode
+        sql = wxT("CREATE SERVER ") + qtIdent(name);
+        AppendIfFilled(sql, wxT("\n   TYPE "), qtIdent(txtType->GetValue()));
+        AppendIfFilled(sql, wxT("\n   VERSION "), qtIdent(txtVersion->GetValue()));
+
+        // check for options
+        if (lstOptions->GetItemCount() > 0)
+        {
+            wxString options = wxEmptyString;
+            for (int pos=0 ; pos < lstOptions->GetItemCount() ; pos++)
+            {
+                if (options.Length() > 0)
+                    options += wxT(", ");
+
+                options += lstOptions->GetText(pos, 0)
+                    + wxT(" '") + lstOptions->GetText(pos, 1) + wxT("' ");
+            }
+            sql += wxT("\n  OPTIONS (") + options + wxT(")");
+        }
+
+        sql += wxT(";\n");
+        AppendOwnerNew(sql, wxT("SERVER ") + qtIdent(name));
+    }
+
+    sql += GetGrant(wxT("U"), wxT("SERVER ") + qtIdent(name));
+    AppendComment(sql, wxT("SERVER ") + qtIdent(name), 0, foreignserver);
+
+    return sql;
+}
+
+
diff --git a/pgadmin/dlg/module.mk b/pgadmin/dlg/module.mk
index 4fa568d..b19b308 100644
--- a/pgadmin/dlg/module.mk
+++ b/pgadmin/dlg/module.mk
@@ -22,7 +22,9 @@ pgadmin3_SOURCES += \
 	$(srcdir)/dlg/dlgDomain.cpp \
 	$(srcdir)/dlg/dlgEditGridOptions.cpp \
 	$(srcdir)/dlg/dlgFindReplace.cpp \
+	$(srcdir)/dlg/dlgForeignDataWrapper.cpp \
 	$(srcdir)/dlg/dlgForeignKey.cpp \
+	$(srcdir)/dlg/dlgForeignServer.cpp \
 	$(srcdir)/dlg/dlgFunction.cpp \
 	$(srcdir)/dlg/dlgGroup.cpp \
 	$(srcdir)/dlg/dlgHbaConfig.cpp \
diff --git a/pgadmin/frm/frmOptions.cpp b/pgadmin/frm/frmOptions.cpp
index bfa3c14..fb636b0 100644
--- a/pgadmin/frm/frmOptions.cpp
+++ b/pgadmin/frm/frmOptions.cpp
@@ -304,6 +304,7 @@ frmOptions::frmOptions(frmMain *parent)
     lstDisplay->Append(_("Resource Queues"));
     lstDisplay->Append(_("Catalogs"));
     lstDisplay->Append(_("Casts"));
+    lstDisplay->Append(_("Foreign Data Wrappers"));
     lstDisplay->Append(_("Languages"));
     lstDisplay->Append(_("Public Synonyms"));
     lstDisplay->Append(_("Schemas"));
diff --git a/pgadmin/include/dlg/dlgForeignDataWrapper.h b/pgadmin/include/dlg/dlgForeignDataWrapper.h
new file mode 100644
index 0000000..7120b96
--- /dev/null
+++ b/pgadmin/include/dlg/dlgForeignDataWrapper.h
@@ -0,0 +1,51 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID:      $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// dlgForeignDataWrapper.h - Foreign Data Wrapper property
+//
+//////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __DLG_FOREIGNDATAWRAPPERPROP
+#define __DLG_FOREIGNDATAWRAPPERPROP
+
+#include "dlg/dlgProperty.h"
+
+class pgForeignDataWrapper;
+
+class dlgForeignDataWrapper : public dlgSecurityProperty
+{
+public:
+    dlgForeignDataWrapper(pgaFactory *factory, frmMain *frame, pgForeignDataWrapper *_fdw);
+    int Go(bool modal);
+
+    void CheckChange();
+    wxString GetSql();
+    pgObject *CreateObject(pgCollection *collection);
+    pgObject *GetObject();
+
+private:
+    pgForeignDataWrapper *fdw;
+
+    void OnChange(wxCommandEvent &ev);
+#ifdef __WXMAC__
+    void OnChangeSize(wxSizeEvent &ev);
+#endif
+
+    void OnSelChangeOption(wxListEvent &ev);
+    void OnChangeOptionName(wxCommandEvent &ev);
+    void OnAddOption(wxCommandEvent &ev);
+    void OnChangeOption(wxCommandEvent &ev);
+    void OnRemoveOption(wxCommandEvent &ev);
+
+    wxString GetOptionsSql();
+
+    DECLARE_EVENT_TABLE()
+};
+
+
+#endif
diff --git a/pgadmin/include/dlg/dlgForeignServer.h b/pgadmin/include/dlg/dlgForeignServer.h
new file mode 100644
index 0000000..3bb9f8a
--- /dev/null
+++ b/pgadmin/include/dlg/dlgForeignServer.h
@@ -0,0 +1,50 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID:      $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// dlgForeignServer.h - Foreign Server property
+//
+//////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __DLG_FOREIGNSERVERPROP
+#define __DLG_FOREIGNSERVERPROP
+
+#include "dlg/dlgProperty.h"
+
+class pgForeignServer;
+
+class dlgForeignServer : public dlgSecurityProperty
+{
+public:
+    dlgForeignServer(pgaFactory *factory, frmMain *frame, pgForeignServer *_foreignserver);
+    int Go(bool modal);
+
+    void CheckChange();
+    wxString GetSql();
+    pgObject *CreateObject(pgCollection *collection);
+    pgObject *GetObject();
+
+private:
+    pgForeignServer *foreignserver;
+
+#ifdef __WXMAC__
+    void OnChangeSize(wxSizeEvent &ev);
+#endif
+
+    void OnSelChangeOption(wxListEvent &ev);
+    void OnChangeOptionName(wxCommandEvent &ev);
+    void OnAddOption(wxCommandEvent &ev);
+    void OnChangeOption(wxCommandEvent &ev);
+    void OnRemoveOption(wxCommandEvent &ev);
+
+    wxString GetOptionsSql();
+
+    DECLARE_EVENT_TABLE()
+};
+
+
+#endif
diff --git a/pgadmin/include/dlg/module.mk b/pgadmin/include/dlg/module.mk
index 14afb22..2cf1397 100644
--- a/pgadmin/include/dlg/module.mk
+++ b/pgadmin/include/dlg/module.mk
@@ -22,7 +22,9 @@ pgadmin3_SOURCES += \
 	$(srcdir)/include/dlg/dlgDomain.h \
 	$(srcdir)/include/dlg/dlgEditGridOptions.h \
 	$(srcdir)/include/dlg/dlgFindReplace.h \
+	$(srcdir)/include/dlg/dlgForeignDataWrapper.h \
 	$(srcdir)/include/dlg/dlgForeignKey.h \
+	$(srcdir)/include/dlg/dlgForeignServer.h \
 	$(srcdir)/include/dlg/dlgFunction.h \
 	$(srcdir)/include/dlg/dlgGroup.h \
 	$(srcdir)/include/dlg/dlgHbaConfig.h \
diff --git a/pgadmin/include/images/foreigndatawrapper-sm.xpm b/pgadmin/include/images/foreigndatawrapper-sm.xpm
new file mode 100644
index 0000000..c4866c6
--- /dev/null
+++ b/pgadmin/include/images/foreigndatawrapper-sm.xpm
@@ -0,0 +1,57 @@
+/* XPM */
+static const char * foreigndatawrapper_sm_xpm[] = {
+"16 16 38 1",
+" 	c None",
+".	c #EBD986",
+"+	c #E0C259",
+"@	c #D8B129",
+"#	c #F7EFD4",
+"$	c #D8B31F",
+"%	c #E3CD39",
+"&	c #EDE24F",
+"*	c #F4F25F",
+"=	c #F4EAC5",
+"-	c #DAB723",
+";	c #ECDE4B",
+">	c #F8F967",
+",	c #E6D069",
+"'	c #E8D643",
+")	c #F8FA69",
+"!	c #E8D180",
+"~	c #DAB632",
+"{	c #F4EE5F",
+"]	c #F9FA6B",
+"^	c #DAB638",
+"/	c #F4EF60",
+"(	c #FAFB6D",
+"_	c #E9D647",
+":	c #FBFB6F",
+"<	c #DBB825",
+"[	c #EEE053",
+"}	c #FCFC72",
+"|	c #D9B320",
+"1	c #E6CE3F",
+"2	c #F1E559",
+"3	c #FAF56C",
+"4	c #FDFC74",
+"5	c #D6AD1E",
+"6	c #D4AA16",
+"7	c #FEFD76",
+"8	c #E6CD76",
+"9	c #FFFD78",
+"                ",
+"                ",
+"     .+@@+ #    ",
+"    $%&**&%$=   ",
+"   -;>>>>>>;-   ",
+"  ,'))))))))'!  ",
+"  ~{]]]]]]]]{^  ",
+"  ^/((((((((/^  ",
+"  !_::::::::_!  ",
+"   <[}}}}}}[<   ",
+"   =|123344|    ",
+"      +56776    ",
+"        8696    ",
+"          68    ",
+"                ",
+"                "};
diff --git a/pgadmin/include/images/foreigndatawrapper.xpm b/pgadmin/include/images/foreigndatawrapper.xpm
new file mode 100644
index 0000000..7deffbd
--- /dev/null
+++ b/pgadmin/include/images/foreigndatawrapper.xpm
@@ -0,0 +1,64 @@
+/* XPM */
+static const char * foreigndatawrapper_xpm[] = {
+"16 16 45 1",
+" 	c None",
+".	c #E2C561",
+"+	c #DAB534",
+"@	c #D5AB1A",
+"#	c #EDDB9C",
+"$	c #D9B420",
+"%	c #E3CB38",
+"&	c #ECE04C",
+"*	c #F2EF5C",
+"=	c #F6F865",
+"-	c #F0E2B0",
+";	c #DFC32F",
+">	c #EFE552",
+",	c #F8F966",
+"'	c #DDBE2B",
+")	c #F2EB5A",
+"!	c #F8F968",
+"~	c #E5CB71",
+"{	c #EADB48",
+"]	c #F9FA69",
+"^	c #D9B432",
+"/	c #F5F061",
+"(	c #F9FA6B",
+"_	c #F5F162",
+":	c #FAFB6D",
+"<	c #ECDB4B",
+"[	c #FBFB6E",
+"}	c #DEBF2D",
+"|	c #F5ED60",
+"1	c #FCFB70",
+"2	c #EDDC9E",
+"3	c #E1C433",
+"4	c #F2E75B",
+"5	c #FCFC72",
+"6	c #D9B522",
+"7	c #E5CD3E",
+"8	c #F0E256",
+"9	c #F8F168",
+"0	c #FCFB73",
+"a	c #FDFC74",
+"b	c #D4AA16",
+"c	c #FEFD75",
+"d	c #E6CD76",
+"e	c #FEFD77",
+"f	c #FFFD78",
+"     .+@+.#     ",
+"   $%&*=*&%$-   ",
+"  ;>,,,,,,,>;   ",
+" ')!!!!!!!!!)'  ",
+"~{]]]]]]]]]]]{~ ",
+"^/(((((((((((/^ ",
+"^_:::::::::::_^ ",
+"~<[[[[[[[[[[[<~ ",
+" }|111111111|}  ",
+" 234555555553   ",
+"  -67890aaaab   ",
+"    #.+@bcccb   ",
+"        dbeeb   ",
+"         dbfb   ",
+"          dbd   ",
+"                "};
diff --git a/pgadmin/include/images/foreigndatawrappers.xpm b/pgadmin/include/images/foreigndatawrappers.xpm
new file mode 100644
index 0000000..42a902e
--- /dev/null
+++ b/pgadmin/include/images/foreigndatawrappers.xpm
@@ -0,0 +1,65 @@
+/* XPM */
+static const char * foreigndatawrappers_xpm[] = {
+"16 16 46 1",
+" 	c None",
+".	c #ECDA99",
+"+	c #E0C259",
+"@	c #D8B129",
+"#	c #D8B31F",
+"$	c #E3CD39",
+"%	c #EDE24F",
+"&	c #F4F25F",
+"*	c #F4EAC5",
+"=	c #DAB723",
+"-	c #ECDE4B",
+";	c #F8F967",
+">	c #F4F05E",
+",	c #E8D643",
+"'	c #DEC12D",
+")	c #D7B11D",
+"!	c #DBB925",
+"~	c #E8D180",
+"{	c #F8FA69",
+"]	c #EFE654",
+"^	c #DAB638",
+"/	c #F4EE5F",
+"(	c #F3ED5D",
+"_	c #F4EF60",
+":	c #E5CF3E",
+"<	c #E9D647",
+"[	c #DAB623",
+"}	c #DBB825",
+"|	c #D8B21F",
+"1	c #D6AE1B",
+"2	c #F9FA6B",
+"3	c #F4E9C4",
+"4	c #FAFB6D",
+"5	c #FBFB6F",
+"6	c #EEE053",
+"7	c #FCFC72",
+"8	c #D9B320",
+"9	c #E6CE3F",
+"0	c #F1E559",
+"a	c #FAF56C",
+"b	c #FDFC74",
+"c	c #D6AD1E",
+"d	c #D4AA16",
+"e	c #FEFD76",
+"f	c #E6CD76",
+"g	c #FFFD78",
+"   .+@@+.       ",
+"  #$%&&%$#*     ",
+" =-;>,'))!)     ",
+"~,{]#$%&&%$#    ",
+"^/(=-;>,'))!)   ",
+"^_:,{]#$%&&%$#  ",
+"~<[/(=-;;;;;;-= ",
+" }|_:,{{{{{{{{,~",
+"  1<[/22222222/^",
+"  3}|_44444444_^",
+"   *1<55555555<~",
+"     }67777776} ",
+"     *890aabb8  ",
+"        +cdeed  ",
+"          fdgd  ",
+"           fdf  "};
diff --git a/pgadmin/include/images/module.mk b/pgadmin/include/images/module.mk
index b340359..d5b2099 100644
--- a/pgadmin/include/images/module.mk
+++ b/pgadmin/include/images/module.mk
@@ -105,6 +105,7 @@ pgadmin3_SOURCES += \
 	$(srcdir)/include/images/file_open.xpm \
 	$(srcdir)/include/images/file_save.xpm \
 	$(srcdir)/include/images/folder.xpm \
+	$(srcdir)/include/images/foreigndatawrapper.xpm \
 	$(srcdir)/include/images/foreignkey.xpm \
 	$(srcdir)/include/images/forward.xpm \
 	$(srcdir)/include/images/function.xpm \
diff --git a/pgadmin/include/precomp.h b/pgadmin/include/precomp.h
index 0277ae4..b8ffedb 100644
--- a/pgadmin/include/precomp.h
+++ b/pgadmin/include/precomp.h
@@ -77,7 +77,9 @@
 #include "dlg/dlgDomain.h"
 #include "dlg/dlgEditGridOptions.h"
 #include "dlg/dlgFindReplace.h"
+#include "dlg/dlgForeignDataWrapper.h"
 #include "dlg/dlgForeignKey.h"
+#include "dlg/dlgForeignServer.h"
 #include "dlg/dlgFunction.h"
 #include "dlg/dlgGroup.h"
 #include "dlg/dlgHbaConfig.h"
@@ -168,7 +170,9 @@
 #include "schema/pgDatabase.h"
 #include "schema/pgDatatype.h"
 #include "schema/pgDomain.h"
+#include "schema/pgForeignDataWrapper.h"
 #include "schema/pgForeignKey.h"
+#include "schema/pgForeignServer.h"
 #include "schema/pgFunction.h"
 #include "schema/pgGroup.h"
 #include "schema/pgIndex.h"
diff --git a/pgadmin/include/schema/module.mk b/pgadmin/include/schema/module.mk
index 2b9a38d..7e43d76 100644
--- a/pgadmin/include/schema/module.mk
+++ b/pgadmin/include/schema/module.mk
@@ -25,7 +25,9 @@ pgadmin3_SOURCES += \
 	$(srcdir)/include/schema/pgDatabase.h \
 	$(srcdir)/include/schema/pgDatatype.h \
 	$(srcdir)/include/schema/pgDomain.h \
-	$(srcdir)/include/schema/pgForeignKey.h \
+	$(srcdir)/include/schema/pgForeignDataWrapper.h \
+	$(srcdir)/include/schema/pgForeignDataWrapper.h \
+	$(srcdir)/include/schema/pgForeignServer.h \
 	$(srcdir)/include/schema/pgFunction.h \
 	$(srcdir)/include/schema/pgGroup.h \
 	$(srcdir)/include/schema/pgIndex.h \
diff --git a/pgadmin/include/schema/pgForeignDataWrapper.h b/pgadmin/include/schema/pgForeignDataWrapper.h
new file mode 100644
index 0000000..07add84
--- /dev/null
+++ b/pgadmin/include/schema/pgForeignDataWrapper.h
@@ -0,0 +1,102 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID:      $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// pgForeignDataWrapper.h PostgreSQL Foreign Data Wrapper
+//
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef PGFOREIGNDATAWRAPPER_H
+#define PGFOREIGNDATAWRAPPER_H
+
+#include "pgDatabase.h"
+
+
+//class pgCollection;
+class pgForeignDataWrapperFactory : public pgDatabaseObjFactory
+{
+public:
+    pgForeignDataWrapperFactory();
+    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);
+};
+
+extern pgForeignDataWrapperFactory foreignDataWrapperFactory;
+
+class pgForeignDataWrapper : public pgDatabaseObject
+{
+public:
+    pgForeignDataWrapper(const wxString& newName = wxT(""));
+
+    void ShowTreeDetail(ctlTree *browser, frmMain *form=0, ctlListView *properties=0, ctlSQLBox *sqlPane=0);
+    bool CanDropCascaded() { return true; }
+
+    wxString GetValidatorProc() const { return validatorProc; }
+    void iSetValidatorProc(const wxString& s) { validatorProc = s; }
+    wxString GetOptions() const { return options; }
+    wxString GetCreateOptions();
+    void iSetOptions(const wxString& s) { options=s; }
+
+    bool DropObject(wxFrame *frame, ctlTree *browser, bool cascaded);
+    wxString GetSql(ctlTree *browser);
+    pgObject *Refresh(ctlTree *browser, const wxTreeItemId item);
+    wxMenu *GetNewMenu();
+
+    bool HasStats() { return false; }
+    bool HasDepends() { return true; }
+    bool HasReferences() { return true; }
+
+private:
+    wxString validatorProc, options;
+};
+
+
+////////////////////////////////////////////////
+
+class pgForeignDataWrapperObjFactory : public pgDatabaseObjFactory
+{
+public:
+    pgForeignDataWrapperObjFactory(const wxChar *tn, const wxChar *ns, const wxChar *nls, const char **img, const char **imgSm=0) 
+        : pgDatabaseObjFactory(tn, ns, nls, img, imgSm) {}
+    virtual pgCollection *CreateCollection(pgObject *obj);
+};
+
+
+// Object that lives in a database
+class pgForeignDataWrapperObject : public pgDatabaseObject
+{
+public:
+    pgForeignDataWrapperObject(pgaFactory &factory, const wxString& newName=wxEmptyString) : pgDatabaseObject(factory, newName) {}
+    pgForeignDataWrapperObject(int newType, const wxString& newName) : pgDatabaseObject(newType, newName) {}
+
+    void iSetForeignDataWrapper(pgForeignDataWrapper *newFDW) { fdwrapper = newFDW; }
+    pgForeignDataWrapper *GetForeignDataWrapper() const { return fdwrapper; }
+
+    bool CanDrop() { return true; }
+    bool CanEdit() { return true; }
+    bool CanCreate() { return true; }
+
+protected:
+    pgForeignDataWrapper *fdwrapper;
+};
+
+
+// collection of pgForeignDataWrapperObject
+class pgForeignDataWrapperObjCollection : public pgCollection
+{
+public:
+    pgForeignDataWrapperObjCollection(pgaFactory *factory, pgForeignDataWrapper *_fdw);
+    bool CanCreate();
+};
+
+
+class pgForeignDataWrapperCollection : public pgDatabaseObjCollection
+{
+public:
+    pgForeignDataWrapperCollection(pgaFactory *factory, pgDatabase *db);
+};
+#endif
diff --git a/pgadmin/include/schema/pgForeignServer.h b/pgadmin/include/schema/pgForeignServer.h
new file mode 100644
index 0000000..ee43994
--- /dev/null
+++ b/pgadmin/include/schema/pgForeignServer.h
@@ -0,0 +1,55 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID:      $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// pgForeignServer.h PostgreSQL Foreign Server
+//
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef PGFOREIGNSERVER_H
+#define PGFOREIGNSERVER_H
+
+#include "pgForeignDataWrapper.h"
+
+class pgCollection;
+class pgForeignServerFactory : public pgForeignDataWrapperObjFactory
+{
+public:
+    pgForeignServerFactory();
+    virtual dlgProperty *CreateDialog(frmMain *frame, pgObject *node, pgObject *parent);
+    virtual pgObject *CreateObjects(pgCollection *obj, ctlTree *browser, const wxString &restr=wxEmptyString);
+};
+extern pgForeignServerFactory foreignServerFactory;
+
+class pgForeignServer : public pgForeignDataWrapperObject
+{
+public:
+    pgForeignServer(const wxString& newName = wxT(""));
+
+    void ShowTreeDetail(ctlTree *browser, frmMain *form=0, ctlListView *properties=0, ctlSQLBox *sqlPane=0);
+    bool CanDropCascaded() { return true; }
+
+    wxString GetType() const { return type; }
+    void iSetType(const wxString& s) { type = s; }
+    wxString GetVersion() const { return version; }
+    void iSetVersion(const wxString& s) { version = s; }
+    wxString GetOptions() const { return options; }
+    wxString GetCreateOptions();
+    void iSetOptions(const wxString& s) { options=s; }
+
+    bool DropObject(wxFrame *frame, ctlTree *browser, bool cascaded);
+    wxString GetSql(ctlTree *browser);
+    pgObject *Refresh(ctlTree *browser, const wxTreeItemId item);
+
+    bool HasStats() { return false; }
+    bool HasDepends() { return true; }
+    bool HasReferences() { return true; }
+
+private:
+    wxString type, version, options;
+};
+
+#endif
diff --git a/pgadmin/include/schema/pgObject.h b/pgadmin/include/schema/pgObject.h
index be8bf28..10fbec2 100644
--- a/pgadmin/include/schema/pgObject.h
+++ b/pgadmin/include/schema/pgObject.h
@@ -25,6 +25,7 @@ class pgSet;
 class pgServer;
 class pgTable;
 class pgaJob;
+class pgForeignDataWrapper;
 
 
 class pgTypes
diff --git a/pgadmin/include/utils/pgDefs.h b/pgadmin/include/utils/pgDefs.h
index e47f6eb..94033a5 100644
--- a/pgadmin/include/utils/pgDefs.h
+++ b/pgadmin/include/utils/pgDefs.h
@@ -36,6 +36,7 @@
 #define PGOID_TYPE_FLOAT8                   701L
 #define PGOID_TYPE_MONEY                    790L
 #define PGOID_TYPE_CHAR_ARRAY               1002L
+#define PGOID_TYPE_TEXT_ARRAY               1009L
 #define PGOID_TYPE_BPCHAR_ARRAY             1014L
 #define PGOID_TYPE_VARCHAR_ARRAY            1015L
 #define PGOID_TYPE_BPCHAR                   1042L
diff --git a/pgadmin/schema/module.mk b/pgadmin/schema/module.mk
index 66b3eb6..978035d 100644
--- a/pgadmin/schema/module.mk
+++ b/pgadmin/schema/module.mk
@@ -27,7 +27,9 @@ pgadmin3_SOURCES += \
         $(subdir)/pgDatabase.cpp \
         $(subdir)/pgDatatype.cpp \
         $(subdir)/pgDomain.cpp \
+        $(subdir)/pgForeignDataWrapper.cpp \
         $(subdir)/pgForeignKey.cpp \
+        $(subdir)/pgForeignServer.cpp \
         $(subdir)/pgFunction.cpp \
         $(subdir)/pgGroup.cpp \
         $(subdir)/pgIndex.cpp \
diff --git a/pgadmin/schema/pgDatabase.cpp b/pgadmin/schema/pgDatabase.cpp
index b0501b2..4f5ec9c 100644
--- a/pgadmin/schema/pgDatabase.cpp
+++ b/pgadmin/schema/pgDatabase.cpp
@@ -19,6 +19,7 @@
 #include "frm/frmMain.h"
 #include "schema/edbSynonym.h"
 #include "schema/pgCast.h"
+#include "schema/pgForeignDataWrapper.h"
 #include "schema/pgLanguage.h"
 #include "schema/pgSchema.h"
 #include "slony/slCluster.h"
@@ -60,6 +61,8 @@ wxMenu *pgDatabase::GetNewMenu()
     {
         if (settings->GetDisplayOption(_("Casts")))
             castFactory.AppendMenu(menu);
+        if (settings->GetDisplayOption(_("Foreign Data Wrappers")))
+            foreignDataWrapperFactory.AppendMenu(menu);
         if (settings->GetDisplayOption(_("Languages")))
             languageFactory.AppendMenu(menu);
         if (settings->GetDisplayOption(_("Public Synonyms")) && GetConnection()->EdbMinimumVersion(8, 0))
@@ -462,6 +465,8 @@ void pgDatabase::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *pr
 				browser->AppendCollection(this, catalogFactory);
 			if (settings->GetDisplayOption(_("Casts")))
 				browser->AppendCollection(this, castFactory);
+			if (settings->GetDisplayOption(_("Foreign Data Wrappers")))
+				browser->AppendCollection(this, foreignDataWrapperFactory);
 			if (settings->GetDisplayOption(_("Languages")))
 				browser->AppendCollection(this, languageFactory);
 			if (settings->GetDisplayOption(_("Public Synonyms")) && connection()->EdbMinimumVersion(8,0))
diff --git a/pgadmin/schema/pgForeignDataWrapper.cpp b/pgadmin/schema/pgForeignDataWrapper.cpp
new file mode 100644
index 0000000..2666b23
--- /dev/null
+++ b/pgadmin/schema/pgForeignDataWrapper.cpp
@@ -0,0 +1,220 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID:      $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// pgForeignDataWrapper.cpp - Foreign Data Wrapper class
+//
+//////////////////////////////////////////////////////////////////////////
+
+// wxWindows headers
+#include <wx/wx.h>
+
+// App headers
+#include "pgAdmin3.h"
+#include "utils/misc.h"
+#include "schema/pgForeignDataWrapper.h"
+#include "schema/pgForeignServer.h"
+
+
+pgForeignDataWrapper::pgForeignDataWrapper(const wxString& newName)
+: pgDatabaseObject(foreignDataWrapperFactory, newName)
+{
+}
+
+bool pgForeignDataWrapper::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded)
+{
+    wxString sql=wxT("DROP FOREIGN DATA WRAPPER ") + GetQuotedFullIdentifier();
+    if (cascaded)
+        sql += wxT(" CASCADE");
+    return GetDatabase()->ExecuteVoid(sql);
+}
+
+
+wxString pgForeignDataWrapper::GetSql(ctlTree *browser)
+{
+    if (sql.IsNull())
+    {
+        sql = wxT("-- Foreign Data Wrapper: ") + GetQuotedFullIdentifier() + wxT("\n\n")
+            + wxT("-- DROP FOREIGN DATA WRAPPER ") + GetQuotedFullIdentifier() + wxT(";")
+            + wxT("\n\nCREATE ");
+        sql += wxT("FOREIGN DATA WRAPPER ") + GetName();
+
+        if (!GetValidatorProc().IsEmpty())
+            sql += wxT("\n  VALIDATOR ") + GetValidatorProc();
+
+        if (!GetOptions().IsEmpty())
+            sql += wxT("\n  OPTIONS (") + GetCreateOptions() + wxT(")");
+
+        sql += wxT(";\n")
+            +  GetOwnerSql(8, 4, wxT("FOREIGN DATA WRAPPER ") + GetName())
+            +  GetGrant(wxT("U"), wxT("FOREIGN DATA WRAPPER ") + GetQuotedFullIdentifier());
+    }
+    return sql;
+}
+
+
+wxMenu *pgForeignDataWrapper::GetNewMenu()
+{
+    wxMenu *menu=pgObject::GetNewMenu();
+
+    if (settings->GetDisplayOption(_("Foreign Servers")))
+        foreignServerFactory.AppendMenu(menu);
+
+    return menu;
+}
+
+void pgForeignDataWrapper::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
+{
+    // Add child nodes if necessary
+    if (browser->GetChildrenCount(GetId(), false) == 0)
+    {
+        wxLogInfo(wxT("Adding child object to foreign data wrapper %s"), GetIdentifier().c_str());
+
+        browser->AppendCollection(this, foreignServerFactory);
+    }
+
+    if (properties)
+    {
+        CreateListColumns(properties);
+
+        properties->AppendItem(_("Name"), GetName());
+        properties->AppendItem(_("OID"), GetOid());
+        properties->AppendItem(_("Owner"), GetOwner());
+        properties->AppendItem(_("ACL"), GetAcl());
+        properties->AppendItem(_("Validator"), GetValidatorProc());
+        properties->AppendItem(_("Options"), GetOptions());
+        properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
+    }
+}
+
+
+
+pgObject *pgForeignDataWrapper::Refresh(ctlTree *browser, const wxTreeItemId item)
+{
+    pgObject *fdw=0;
+    pgCollection *coll=browser->GetParentCollection(item);
+    if (coll)
+        fdw = foreignDataWrapperFactory.CreateObjects(coll, 0, wxT("\n   WHERE fdw.oid=") + GetOidStr());
+
+    return fdw;
+}
+
+
+
+pgObject *pgForeignDataWrapperFactory::CreateObjects(pgCollection *collection, ctlTree *browser, const wxString &restriction)
+{
+    wxString sql;
+    pgForeignDataWrapper *fdw=0;
+
+    sql = wxT("SELECT fdw.oid, fdwname, fdwvalidator, fdwacl, vp.proname as fdwval, description, ")
+        wxT("array_to_string(fdwoptions, ',') AS fdwoptions, ")
+        wxT("pg_get_userbyid(fdwowner) as fdwowner\n");
+    sql += wxT("  FROM pg_foreign_data_wrapper fdw\n")
+        wxT("  LEFT OUTER JOIN pg_proc vp on vp.oid=fdwvalidator\n")
+        wxT("  LEFT OUTER JOIN pg_description des ON des.objoid=fdw.oid AND des.objsubid=0\n")
+        + restriction + wxT("\n")
+        wxT(" ORDER BY fdwname");
+    pgSet *fdws= collection->GetDatabase()->ExecuteSet(sql);
+
+    if (fdws)
+    {
+        while (!fdws->Eof())
+        {
+
+            fdw = new pgForeignDataWrapper(fdws->GetVal(wxT("fdwname")));
+            fdw->iSetDatabase(collection->GetDatabase());
+            fdw->iSetOid(fdws->GetOid(wxT("oid")));
+            fdw->iSetOwner(fdws->GetVal(wxT("fdwowner")));
+            fdw->iSetAcl(fdws->GetVal(wxT("fdwacl")));
+            fdw->iSetComment(fdws->GetVal(wxT("description")));
+            fdw->iSetValidatorProc(fdws->GetVal(wxT("fdwval")));
+            fdw->iSetOptions(fdws->GetVal(wxT("fdwoptions")));
+
+            if (browser)
+            {
+                browser->AppendObject(collection, fdw);
+	
+			    fdws->MoveNext();
+            }
+            else
+                break;
+        }
+
+		delete fdws;
+    }
+    return fdw;
+}
+
+
+wxString pgForeignDataWrapper::GetCreateOptions()
+{
+    wxString options_create = wxEmptyString;
+    wxString opt;
+    wxString val;
+
+    wxStringTokenizer tkz_options(options, wxT(","));
+    while (tkz_options.HasMoreTokens())
+    {
+        wxStringTokenizer tkz_option(tkz_options.GetNextToken(), wxT("="));
+        opt = tkz_option.GetNextToken();
+        val = tkz_option.GetNextToken();
+
+        if (!options_create.IsEmpty())
+            options_create += wxT(",");
+
+        options_create += opt + wxT(" '") + val + wxT("'");
+    }
+
+    return options_create;
+}
+
+
+pgForeignDataWrapperCollection::pgForeignDataWrapperCollection(pgaFactory *factory, pgDatabase *db)
+: pgDatabaseObjCollection(factory, db)
+{
+}
+
+
+///////////////////////////////////////////////////
+
+pgForeignDataWrapperObjCollection::pgForeignDataWrapperObjCollection(pgaFactory *factory, pgForeignDataWrapper *_fdw)
+: pgCollection(factory)
+{ 
+    //fdwrapper = _fdw;
+    //database = fdw->GetDatabase();
+    //server= fdw->GetServer();
+}
+
+
+bool pgForeignDataWrapperObjCollection::CanCreate()
+{
+    return true;
+}
+
+
+#include "images/foreigndatawrapper.xpm"
+#include "images/foreigndatawrapper-sm.xpm"
+#include "images/foreigndatawrappers.xpm"
+
+pgForeignDataWrapperFactory::pgForeignDataWrapperFactory() 
+: pgDatabaseObjFactory(__("Foreign Data Wrapper"), __("New Foreign Data Wrapper..."), __("Create a new Foreign Data Wrapper."), foreigndatawrapper_xpm, foreigndatawrapper_sm_xpm)
+{
+}
+
+
+pgCollection *pgForeignDataWrapperFactory::CreateCollection(pgObject *obj)
+{
+    return new pgForeignDataWrapperCollection(GetCollectionFactory(), (pgDatabase*)obj);
+}
+
+pgCollection *pgForeignDataWrapperObjFactory::CreateCollection(pgObject *obj)
+{
+    return new pgForeignDataWrapperObjCollection(GetCollectionFactory(), (pgForeignDataWrapper*)obj);
+}
+
+
+pgForeignDataWrapperFactory foreignDataWrapperFactory;
+static pgaCollectionFactory cf(&foreignDataWrapperFactory, __("Foreign Data Wrappers"), foreigndatawrappers_xpm);
diff --git a/pgadmin/schema/pgForeignServer.cpp b/pgadmin/schema/pgForeignServer.cpp
new file mode 100644
index 0000000..7a174a5
--- /dev/null
+++ b/pgadmin/schema/pgForeignServer.cpp
@@ -0,0 +1,171 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID:      $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// pgForeignServer.cpp - Foreign Server class
+//
+//////////////////////////////////////////////////////////////////////////
+
+// wxWindows headers
+#include <wx/wx.h>
+
+// App headers
+#include "pgAdmin3.h"
+#include "utils/misc.h"
+#include "schema/pgForeignServer.h"
+
+
+pgForeignServer::pgForeignServer(const wxString& newName)
+: pgForeignDataWrapperObject(foreignServerFactory, newName)
+{
+}
+
+bool pgForeignServer::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded)
+{
+    wxString sql=wxT("DROP SERVER ") + GetQuotedFullIdentifier();
+    if (cascaded)
+        sql += wxT(" CASCADE");
+    return GetDatabase()->ExecuteVoid(sql);
+}
+
+
+wxString pgForeignServer::GetSql(ctlTree *browser)
+{
+    if (sql.IsNull())
+    {
+        sql = wxT("-- Server: ") + GetQuotedFullIdentifier() + wxT("\n\n")
+            + wxT("-- DROP SERVER ") + GetQuotedFullIdentifier() + wxT(";")
+            + wxT("\n\nCREATE SERVER ") + GetName();
+
+        if (!GetType().IsEmpty())
+            sql += wxT("\n  TYPE '") + GetType() + wxT("'");
+
+        if (!GetVersion().IsEmpty())
+            sql += wxT("\n  VERSION '") + GetVersion() + wxT("'");
+
+        if (!GetOptions().IsEmpty())
+            sql += wxT("\n  OPTIONS (") + GetCreateOptions() + wxT(")");
+
+        sql += wxT(";\n")
+            +  GetOwnerSql(8, 4, wxT("SERVER ") + GetName())
+            +  GetGrant(wxT("U"), wxT("FOREIGN SERVER ") + GetQuotedFullIdentifier());
+    }
+    return sql;
+}
+
+
+void pgForeignServer::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
+{
+    if (properties)
+    {
+        CreateListColumns(properties);
+
+        properties->AppendItem(_("Name"), GetName());
+        properties->AppendItem(_("OID"), GetOid());
+        properties->AppendItem(_("Owner"), GetOwner());
+        properties->AppendItem(_("ACL"), GetAcl());
+        properties->AppendItem(_("Type"), GetType());
+        properties->AppendItem(_("Version"), GetVersion());
+        properties->AppendItem(_("Options"), GetOptions());
+        properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
+    }
+}
+
+
+
+pgObject *pgForeignServer::Refresh(ctlTree *browser, const wxTreeItemId item)
+{
+    pgObject *foreignserver=0;
+    pgCollection *coll=browser->GetParentCollection(item);
+    if (coll)
+        foreignserver = foreignServerFactory.CreateObjects(coll, 0, wxT("\n WHERE srv.oid=") + GetOidStr());
+
+    return foreignserver;
+}
+
+
+
+pgObject *pgForeignServerFactory::CreateObjects(pgCollection *collection, ctlTree *browser, const wxString &restriction)
+{
+    wxString sql;
+    pgForeignServer *foreignserver=0;
+
+    sql = wxT("SELECT srv.oid, srvname, srvtype, srvversion, srvacl, fdw.fdwname as fdwname, description, ")
+        wxT("array_to_string(srvoptions, ',') AS srvoptions, ")
+        wxT("pg_get_userbyid(srvowner) as srvowner\n");
+    sql += wxT("  FROM pg_foreign_server srv\n")
+        wxT("  LEFT OUTER JOIN pg_foreigndatawrapper fdw on fdw.oid=srvfdw\n")
+        wxT("  LEFT OUTER JOIN pg_description des ON des.objoid=srv.oid AND des.objsubid=0\n")
+        + restriction + wxT("\n")
+        wxT(" ORDER BY srvname");
+    pgSet *foreignservers= collection->GetDatabase()->ExecuteSet(sql);
+
+    if (foreignservers)
+    {
+        while (!foreignservers->Eof())
+        {
+
+            foreignserver = new pgForeignServer(foreignservers->GetVal(wxT("srvname")));
+            foreignserver->iSetOid(foreignservers->GetOid(wxT("oid")));
+            foreignserver->iSetOwner(foreignservers->GetVal(wxT("srvowner")));
+            foreignserver->iSetAcl(foreignservers->GetVal(wxT("srvacl")));
+            foreignserver->iSetComment(foreignservers->GetVal(wxT("description")));
+            foreignserver->iSetType(foreignservers->GetVal(wxT("srvtype")));
+            foreignserver->iSetVersion(foreignservers->GetVal(wxT("srvversion")));
+
+            if (browser)
+            {
+                browser->AppendObject(collection, foreignserver);
+			    foreignservers->MoveNext();
+            }
+            else
+                break;
+        }
+
+		delete foreignservers;
+    }
+    return foreignserver;
+}
+
+
+wxString pgForeignServer::GetCreateOptions()
+{
+    wxString options_create = wxEmptyString;
+    wxString opt;
+    wxString val;
+
+    wxStringTokenizer tkz_options(options, wxT(","));
+    while (tkz_options.HasMoreTokens())
+    {
+        wxStringTokenizer tkz_option(tkz_options.GetNextToken(), wxT("="));
+        opt = tkz_option.GetNextToken();
+        val = tkz_option.GetNextToken();
+
+        if (!options_create.IsEmpty())
+            options_create += wxT(",");
+
+        options_create += opt + wxT(" '") + val + wxT("'");
+    }
+
+    return options_create;
+}
+
+
+///////////////////////////////////////////////////
+
+#include "images/foreignserver.xpm"
+#include "images/foreignserver-sm.xpm"
+#include "images/foreignservers.xpm"
+
+pgForeignServerFactory::pgForeignServerFactory() 
+: pgForeignDataWrapperObjFactory(__("Foreign Server"), __("New Foreign Server..."),
+__("Create a new Foreign Server."), foreignserver_xpm, foreignserver_sm_xpm)
+{
+}
+
+
+pgForeignServerFactory foreignServerFactory;
+static pgaCollectionFactory cf(&foreignServerFactory, __("Foreign Servers"), foreignservers_xpm);
diff --git a/pgadmin/schema/pgObject.cpp b/pgadmin/schema/pgObject.cpp
index 05c95a1..f07e1ea 100644
--- a/pgadmin/schema/pgObject.cpp
+++ b/pgadmin/schema/pgObject.cpp
@@ -45,6 +45,7 @@
 #include "schema/pgRole.h"
 #include "utils/pgDefs.h"
 #include "agent/pgaJob.h"
+#include "schema/pgForeignDataWrapper.h"
 
 
 int pgObject::GetType() const
diff --git a/pgadmin/ui/dlgForeignDataWrapper.xrc b/pgadmin/ui/dlgForeignDataWrapper.xrc
new file mode 100644
index 0000000..190228f
--- /dev/null
+++ b/pgadmin/ui/dlgForeignDataWrapper.xrc
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<resource>
+  <object class="wxDialog" name="dlgForeignDataWrapper">
+    <title></title>
+    <size>220,250d</size>
+    <style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER|wxRESIZE_BOX|wxTHICK_FRAME</style>
+    <object class="wxFlexGridSizer">
+      <cols>1</cols>
+      <growablecols>0</growablecols>
+      <growablerows>0</growablerows>
+      <object class="sizeritem">
+        <object class="wxNotebook" name="nbNotebook">
+          <size>216,225d</size>
+          <selected>0</selected>
+          <object class="notebookpage">
+            <label>Properties</label>
+            <object class="wxPanel" name="pnlProperties">
+              <object class="wxFlexGridSizer">
+                <cols>2</cols>
+                <rows>6</rows>
+                <vgap>5</vgap>
+                <hgap>5</hgap>
+                <growablerows>4</growablerows>
+                <growablecols>1</growablecols>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stName">
+                    <label>Name</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtName">
+                    <size>135,-1d</size>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stOID">
+                    <label>OID</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtOID">
+                    <size>135,-1d</size>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stOwner">
+                    <label>Owner</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="ctlComboBox" name="cbOwner">
+                    <size>135,-1d</size>
+                    <content/>
+                    <style>wxCB_DROPDOWN</style>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stValidator">
+                    <label>Validator</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="ctlComboBox" name="cbValidator">
+                    <content/>
+                    <size>135,-1d</size>
+                    <style>wxCB_DROPDOWN</style>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stComment">
+                    <label>Comment</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtComment">
+                    <size>135,-1d</size>
+                    <style>wxTE_MULTILINE</style>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stClusterSet">
+                    <label>Use replication</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxALL</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxComboBox" name="cbClusterSet">
+                    <content/>
+                    <size>135,-1d</size>
+                    <style>wxCB_READONLY|wxCB_DROPDOWN</style>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL</flag>
+                  <border>4</border>
+                </object>
+              </object>
+            </object>
+          </object>
+          <object class="notebookpage">
+            <label>Options</label>
+            <object class="wxPanel" name="pnlOptions">
+              <object class="wxFlexGridSizer">
+                <cols>1</cols>
+                <rows>3</rows>
+                <growablerows>0</growablerows>
+                <growablecols>0</growablecols>
+                <object class="sizeritem">
+                  <object class="wxListCtrl" name="lstOptions">
+                    <pos>70,15d</pos>
+                    <style>wxLC_REPORT|wxLC_SINGLE_SEL</style>
+                  </object>
+                  <option>80</option>
+                  <flag>wxALL|wxEXPAND</flag>
+                  <border>5</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxFlexGridSizer">
+                    <cols>2</cols>
+                    <rows>2</rows>
+                    <vgap>5</vgap>
+                    <hgap>5</hgap>
+                    <growablecols>1</growablecols>
+                    <object class="sizeritem">
+                      <object class="wxStaticText" name="stOption">
+                        <label>Option</label>
+                      </object>
+                      <flag>wxALIGN_CENTRE_VERTICAL</flag>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxTextCtrl" name="txtOption">
+                        <size>135,-1d</size>
+                      </object>
+                      <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                      <flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxStaticText" name="stValue">
+                        <label>Value</label>
+                      </object>
+                      <flag>wxALIGN_CENTRE_VERTICAL</flag>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxTextCtrl" name="txtValue">
+                        <size>135,-1d</size>
+                      </object>
+                      <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                      <flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                    </object>
+                  </object>
+                  <flag>wxALL|wxEXPAND|wxALIGN_BOTTOM|wxALIGN_CENTRE_HORIZONTAL</flag>
+                  <border>5</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxFlexGridSizer">
+                    <cols>2</cols>
+                    <rows>1</rows>
+                    <object class="sizeritem">
+                      <object class="wxButton" name="wxID_REMOVE">
+                        <label>Remove</label>
+                        <pos>13,58d</pos>
+                      </object>
+                      <flag>wxALL|wxALIGN_RIGHT</flag>
+                      <border>2</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxButton" name="wxID_ADD">
+                        <label>Add/Change</label>
+                        <pos>13,78d</pos>
+                      </object>
+                      <flag>wxALL|wxALIGN_RIGHT</flag>
+                      <border>2</border>
+                    </object>
+                  </object>
+                  <flag>wxALIGN_RIGHT</flag>
+                </object>
+              </object>
+            </object>
+          </object>
+        </object>
+        <flag>wxALL|wxGROW|wxALIGN_CENTRE</flag>
+        <border>3</border>
+      </object>
+      <object class="spacer">
+        <size>2,2d</size>
+      </object>
+      <object class="sizeritem">
+        <object class="wxFlexGridSizer">
+          <cols>7</cols>
+          <growablecols>2</growablecols>
+          <object class="spacer">
+            <size>3,3d</size>
+          </object>
+          <object class="sizeritem">
+            <object class="wxButton" name="wxID_HELP">
+              <label>Help</label>
+            </object>
+          </object>
+          <object class="spacer">
+            <size>3,3d</size>
+          </object>
+          <object class="sizeritem">
+            <object class="wxButton" name="wxID_OK">
+              <label>&amp;OK</label>
+              <default>1</default>
+            </object>
+          </object>
+          <object class="spacer">
+            <size>3,3d</size>
+          </object>
+          <object class="sizeritem">
+            <object class="wxButton" name="wxID_CANCEL">
+              <label>&amp;Cancel</label>
+            </object>
+          </object>
+          <object class="spacer">
+            <size>3,3d</size>
+          </object>
+        </object>
+        <flag>wxTOP|wxLEFT|wxRIGHT|wxGROW</flag>
+      </object>
+      <object class="spacer">
+        <size>3,3d</size>
+      </object>
+      <object class="sizeritem">
+        <object class="wxStatusBar" name="unkStatusBar">
+          <style>wxST_SIZEGRIP</style>
+        </object>
+        <flag>wxGROW|wxALIGN_CENTRE</flag>
+        <border>3</border>
+      </object>
+    </object>
+  </object>
+</resource>
diff --git a/pgadmin/ui/dlgForeignServer.xrc b/pgadmin/ui/dlgForeignServer.xrc
new file mode 100644
index 0000000..03c5bff
--- /dev/null
+++ b/pgadmin/ui/dlgForeignServer.xrc
@@ -0,0 +1,267 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<resource>
+  <object class="wxDialog" name="dlgForeignServer">
+    <title></title>
+    <size>220,250d</size>
+    <style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER|wxRESIZE_BOX|wxTHICK_FRAME</style>
+    <object class="wxFlexGridSizer">
+      <cols>1</cols>
+      <growablecols>0</growablecols>
+      <growablerows>0</growablerows>
+      <object class="sizeritem">
+        <object class="wxNotebook" name="nbNotebook">
+          <size>216,225d</size>
+          <selected>0</selected>
+          <object class="notebookpage">
+            <label>Properties</label>
+            <object class="wxPanel" name="pnlProperties">
+              <object class="wxFlexGridSizer">
+                <cols>2</cols>
+                <rows>6</rows>
+                <vgap>5</vgap>
+                <hgap>5</hgap>
+                <growablerows>4</growablerows>
+                <growablecols>1</growablecols>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stName">
+                    <label>Name</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtName">
+                    <size>135,-1d</size>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stOID">
+                    <label>OID</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtOID">
+                    <size>135,-1d</size>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stOwner">
+                    <label>Owner</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="ctlComboBox" name="cbOwner">
+                    <size>135,-1d</size>
+                    <content/>
+                    <style>wxCB_DROPDOWN</style>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stType">
+                    <label>Type</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtType">
+                    <size>135,-1d</size>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stVersion">
+                    <label>Version</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtVersion">
+                    <size>135,-1d</size>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stComment">
+                    <label>Comment</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtComment">
+                    <size>135,-1d</size>
+                    <style>wxTE_MULTILINE</style>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stClusterSet">
+                    <label>Use replication</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxALL</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxComboBox" name="cbClusterSet">
+                    <content/>
+                    <size>135,-1d</size>
+                    <style>wxCB_READONLY|wxCB_DROPDOWN</style>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL</flag>
+                  <border>4</border>
+                </object>
+              </object>
+            </object>
+          </object>
+          <object class="notebookpage">
+            <label>Options</label>
+            <object class="wxPanel" name="pnlOptions">
+              <object class="wxFlexGridSizer">
+                <cols>1</cols>
+                <rows>3</rows>
+                <growablerows>0</growablerows>
+                <growablecols>0</growablecols>
+                <object class="sizeritem">
+                  <object class="wxListCtrl" name="lstOptions">
+                    <pos>70,15d</pos>
+                    <style>wxLC_REPORT|wxLC_SINGLE_SEL</style>
+                  </object>
+                  <option>80</option>
+                  <flag>wxALL|wxEXPAND</flag>
+                  <border>5</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxFlexGridSizer">
+                    <cols>2</cols>
+                    <rows>2</rows>
+                    <vgap>5</vgap>
+                    <hgap>5</hgap>
+                    <growablecols>1</growablecols>
+                    <object class="sizeritem">
+                      <object class="wxStaticText" name="stOption">
+                        <label>Option</label>
+                      </object>
+                      <flag>wxALIGN_CENTRE_VERTICAL</flag>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxTextCtrl" name="txtOption">
+                        <size>135,-1d</size>
+                      </object>
+                      <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                      <flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxStaticText" name="stValue">
+                        <label>Value</label>
+                      </object>
+                      <flag>wxALIGN_CENTRE_VERTICAL</flag>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxTextCtrl" name="txtValue">
+                        <size>135,-1d</size>
+                      </object>
+                      <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                      <flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                    </object>
+                  </object>
+                  <flag>wxALL|wxEXPAND|wxALIGN_BOTTOM|wxALIGN_CENTRE_HORIZONTAL</flag>
+                  <border>5</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxFlexGridSizer">
+                    <cols>2</cols>
+                    <rows>1</rows>
+                    <object class="sizeritem">
+                      <object class="wxButton" name="wxID_REMOVE">
+                        <label>Remove</label>
+                        <pos>13,58d</pos>
+                      </object>
+                      <flag>wxALL|wxALIGN_RIGHT</flag>
+                      <border>2</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxButton" name="wxID_ADD">
+                        <label>Add/Change</label>
+                        <pos>13,78d</pos>
+                      </object>
+                      <flag>wxALL|wxALIGN_RIGHT</flag>
+                      <border>2</border>
+                    </object>
+                  </object>
+                  <flag>wxALIGN_RIGHT</flag>
+                </object>
+              </object>
+            </object>
+          </object>
+        </object>
+        <flag>wxALL|wxGROW|wxALIGN_CENTRE</flag>
+        <border>3</border>
+      </object>
+      <object class="spacer">
+        <size>2,2d</size>
+      </object>
+      <object class="sizeritem">
+        <object class="wxFlexGridSizer">
+          <cols>7</cols>
+          <growablecols>2</growablecols>
+          <object class="spacer">
+            <size>3,3d</size>
+          </object>
+          <object class="sizeritem">
+            <object class="wxButton" name="wxID_HELP">
+              <label>Help</label>
+            </object>
+          </object>
+          <object class="spacer">
+            <size>3,3d</size>
+          </object>
+          <object class="sizeritem">
+            <object class="wxButton" name="wxID_OK">
+              <label>&amp;OK</label>
+              <default>1</default>
+            </object>
+          </object>
+          <object class="spacer">
+            <size>3,3d</size>
+          </object>
+          <object class="sizeritem">
+            <object class="wxButton" name="wxID_CANCEL">
+              <label>&amp;Cancel</label>
+            </object>
+          </object>
+          <object class="spacer">
+            <size>3,3d</size>
+          </object>
+        </object>
+        <flag>wxTOP|wxLEFT|wxRIGHT|wxGROW</flag>
+      </object>
+      <object class="spacer">
+        <size>3,3d</size>
+      </object>
+      <object class="sizeritem">
+        <object class="wxStatusBar" name="unkStatusBar">
+          <style>wxST_SIZEGRIP</style>
+        </object>
+        <flag>wxGROW|wxALIGN_CENTRE</flag>
+        <border>3</border>
+      </object>
+    </object>
+  </object>
+</resource>
diff --git a/pgadmin/ui/module.mk b/pgadmin/ui/module.mk
index 1a0868c..b4688f7 100644
--- a/pgadmin/ui/module.mk
+++ b/pgadmin/ui/module.mk
@@ -26,7 +26,9 @@ TMP_ui += \
 	$(srcdir)/ui/dlgEditGridOptions.xrc \
 	$(srcdir)/ui/dlgExtTable.xrc \
 	$(srcdir)/ui/dlgFindReplace.xrc \
+	$(srcdir)/ui/dlgForeignDataWrapper.xrc \
 	$(srcdir)/ui/dlgForeignKey.xrc \
+	$(srcdir)/ui/dlgForeignServer.xrc \
 	$(srcdir)/ui/dlgFunction.xrc \
 	$(srcdir)/ui/dlgGroup.xrc \
 	$(srcdir)/ui/dlgHbaConfig.xrc \
diff --git a/pgadmin/utils/sysSettings.cpp b/pgadmin/utils/sysSettings.cpp
index 3cb37f4..6723b52 100644
--- a/pgadmin/utils/sysSettings.cpp
+++ b/pgadmin/utils/sysSettings.cpp
@@ -83,6 +83,11 @@ bool sysSettings::GetDisplayOption(const wxString &objtype, bool GetDefault)
         engtype = wxT("Casts");
         def = false;
     }
+    else if (objtype == _("Foreign Data Wrappers")) 
+    {
+        engtype = wxT("Foreign Data Wrappers");
+        def = false;
+    }
     else if (objtype == _("Languages")) 
     {
         engtype = wxT("Languages");
@@ -172,6 +177,7 @@ void sysSettings::SetDisplayOption(const wxString &objtype, bool display)
     else if (objtype == _("Resource Queues")) engtype = wxT("Resource Queues");
     else if (objtype == _("Catalogs")) engtype = wxT("Catalogs");
     else if (objtype == _("Casts")) engtype = wxT("Casts");
+    else if (objtype == _("Foreign Data Wrappers")) engtype = wxT("Foreign Data Wrappers");
     else if (objtype == _("Languages")) engtype = wxT("Languages");
     else if (objtype == _("Public Synonyms")) engtype = wxT("Public Synonyms");
     else if (objtype == _("Schemas")) engtype = wxT("Schemas");
