Please find the updated patch.
Sorry for inconvenience..

--
Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise Postgres Company<http://www.enterprisedb.com>


On Thu, Apr 22, 2010 at 4:03 PM, Ashesh Vashi <ashesh.va...@enterprisedb.com
> wrote:

> Please find the updated patch for the same.
>
> Guillaume,
>
> Please remove the two files (if exists) before applying the patch.
> *ctl/ctlDefaultSecurityPanel.cpp*
> *include/ctl/ctlDefaultSecurityPanel.h*
>
> --
> Thanks & Regards,
>
> Ashesh Vashi
> EnterpriseDB INDIA: Enterprise Postgres Company<http://www.enterprisedb.com>
>
>
> On Mon, Apr 5, 2010 at 5:25 PM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>> Oh sorry.. right..
>>
>>
>> --
>> Thanks & Regards,
>>
>> Ashesh Vashi
>> EnterpriseDB INDIA: Enterprise Postgres Company<http://www.enterprisedb.com>
>>
>>
>> On Mon, Apr 5, 2010 at 5:24 PM, Guillaume Lelarge <guilla...@lelarge.info
>> > wrote:
>>
>>> Le 05/04/2010 13:52, Ashesh Vashi a écrit :
>>> > hmm.. That's strange...
>>> > It should..  :-(
>>> >
>>> > The log, sent by you, suggests that, they were created on your system..
>>> > i.e.
>>> > */include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXDEBUG__
>>> > -D__WXGTK__ -g -O0 -I/usr/include/libxml2 -I/usr/include/libxml2
>>> > -DDATA_DIR=\"/opt/pgadmin-trunk/share/pgadmin3/\" -Wall
>>> > -Wno-non-virtual-dtor -fno-strict-aliasing -I../pgadmin/include   -MT
>>> > ctlDefaultSecurityPanel.o -MD -MP -MF .deps/ctlDefaultSecurityPanel.Tpo
>>> -c
>>> > -o ctlDefaultSecurityPanel.o `test -f
>>> './ctl/ctlDefaultSecurityPanel.cpp' ||
>>> > echo './'`./ctl/ctlDefaultSecurityPanel.cpp*
>>> > *./ctl/ctlDefaultSecurityPanel.cpp:812: error: ISO C++ does not permit
>>> > ‘wxPanel::sm_eventTable’ to be defined as
>>> > ‘ctlDefaultSecurityPanel::sm_eventTable’*
>>> > */opt/wxgtk-2.8/include/wx-2.8/wx/generic/panelg.h:91: error: ‘const
>>> > wxEventTableEntry wxPanel::sm_eventTableEntries []’ is private*
>>> > *./ctl/ctlDefaultSecurityPanel.cpp:812: error: within this context*
>>> >
>>>
>>> You were talking about ctlDefaultPrivileges.h and
>>> ctlDefaultPrivileges.cpp, not ctlDefaultSecurityPanel.cpp, weren't you?
>>>
>>>
>>> --
>>> Guillaume.
>>>  http://www.postgresqlfr.org
>>>  http://dalibo.com
>>>
>>
>>
>
Index: ctl/module.mk
===================================================================
--- ctl/module.mk	(revision 8291)
+++ ctl/module.mk	(working copy)
@@ -19,6 +19,7 @@
         $(srcdir)/ctl/ctlSQLBox.cpp \
         $(srcdir)/ctl/ctlSQLGrid.cpp \
         $(srcdir)/ctl/ctlSQLResult.cpp \
+        $(srcdir)/ctl/ctlDefaultSecurityPanel.cpp \
         $(srcdir)/ctl/ctlSecurityPanel.cpp \
         $(srcdir)/ctl/ctlTree.cpp \
         $(srcdir)/ctl/explainCanvas.cpp \
Index: include/ctl/module.mk
===================================================================
--- include/ctl/module.mk	(revision 8291)
+++ include/ctl/module.mk	(working copy)
@@ -16,6 +16,7 @@
 	$(srcdir)/include/ctl/ctlComboBox.h \
 	$(srcdir)/include/ctl/ctlListView.h \
 	$(srcdir)/include/ctl/ctlMenuToolbar.h \
+	$(srcdir)/include/ctl/ctlDefaultSecurityPanel.h \
 	$(srcdir)/include/ctl/ctlSecurityPanel.h \
 	$(srcdir)/include/ctl/ctlSQLBox.h \
 	$(srcdir)/include/ctl/ctlSQLGrid.h \
Index: include/dlg/dlgDatabase.h
===================================================================
--- include/dlg/dlgDatabase.h	(revision 8291)
+++ include/dlg/dlgDatabase.h	(working copy)
@@ -17,7 +17,7 @@
 
 class pgDatabase;
 
-class dlgDatabase : public dlgSecurityProperty
+class dlgDatabase : public dlgDefaultSecurityProperty
 {
 public:
     dlgDatabase(pgaFactory *factory, frmMain *frame, pgDatabase *db);
@@ -54,6 +54,7 @@
     void OnOK(wxCommandEvent &ev);
 
     void SetupVarEditor(int var);
+    bool executeDDLSql(const wxString& strSql);
 
 	bool dirtyVars;
 
Index: include/dlg/dlgSchema.h
===================================================================
--- include/dlg/dlgSchema.h	(revision 8291)
+++ include/dlg/dlgSchema.h	(working copy)
@@ -17,7 +17,7 @@
 
 class pgSchema;
 
-class dlgSchema : public dlgSecurityProperty
+class dlgSchema : public dlgDefaultSecurityProperty
 {
 public:
     dlgSchema(pgaFactory *factory, frmMain *frame, pgSchema *db);
Index: include/dlg/dlgProperty.h
===================================================================
--- include/dlg/dlgProperty.h	(revision 8291)
+++ include/dlg/dlgProperty.h	(working copy)
@@ -23,7 +23,6 @@
 class pgSchema;
 class pgTable;
 class frmMain;
-class ctlSecurityPanel;
 class pgaFactory;
 
 #define stComment       CTRL_STATIC("stComment")
@@ -45,6 +44,23 @@
        
 };
 
+
+/*
+ * We need the definition of replClientData in dlgDatabase too, to hack
+ * the execution of default privileges statements (sqls) before getting
+ * disconnected.
+ */
+class replClientData : public wxClientData
+{
+public:
+    replClientData(const wxString &c, long s, long ma, long mi) { cluster=c; setId=s; majorVer=ma; minorVer=mi; }
+    wxString cluster;
+    long setId;
+    long majorVer;
+    long minorVer;
+};
+
+
 WX_DEFINE_ARRAY(dataType *, dataTypeCache);
 
 class dlgProperty : public DialogWithHelp
@@ -67,7 +83,7 @@
     virtual void CreateAdditionalPages();
     virtual wxString GetHelpPage() const;
     virtual wxString GetHelpPage(bool forCreate) const { return wxEmptyString; }
-    void SetConnection(pgConn *conn) { connection=conn; }
+    virtual void SetConnection(pgConn *conn) { connection=conn; }
     void SetDatabase(pgDatabase *db);
     void SetDatatypeCache(dataTypeCache cache);
     virtual int Go(bool modal=false);
@@ -212,20 +228,52 @@
     void OnChangeSize(wxSizeEvent &ev);
 #endif
 
+    ctlSecurityPanel *securityPage;
+
 private:
 
     void OnAddPriv(wxCommandEvent& ev);
     void OnDelPriv(wxCommandEvent& ev);
     bool securityChanged;
 
-    ctlSecurityPanel *securityPage;
     wxArrayString currentAcl;
 
     DECLARE_EVENT_TABLE()
 };
 
+class ctlDefaultSecurityPanel;
 
+class dlgDefaultSecurityProperty : public dlgSecurityProperty
+{
 
+protected:
+    dlgDefaultSecurityProperty(pgaFactory *factory, frmMain *frame, pgObject *obj, const wxString &resName,
+                               const wxString& privilegeList, const char *privilegeChar, bool createDefPrivPanel=true);
+
+    virtual int      Go(bool modal=false, const wxString& schemaOid=wxT("0::OID"));
+    virtual wxString GetHelpPage() const;
+
+    void     EnableOK(bool enable);
+    wxString GetDefaultPrivileges(const wxString& schemaName = wxT(""));
+    void     AddGroups(ctlComboBox *comboBox=0);
+    void     AddUsers(ctlComboBox *comboBox=0);
+#ifdef __WXMAC__
+    void        OnChangeSize(wxSizeEvent &ev);
+#endif
+
+    bool defaultSecurityChanged;
+
+private:
+    void OnAddPriv(wxCommandEvent& ev);
+    void OnDelPriv(wxCommandEvent& ev);
+
+    ctlDefaultSecurityPanel *defaultSecurityPage;
+
+    DECLARE_EVENT_TABLE()
+};
+
+
+
 class dlgAgentProperty : public dlgProperty
 {
 public:
Index: pgAdmin3.vcproj
===================================================================
--- pgAdmin3.vcproj	(revision 8291)
+++ pgAdmin3.vcproj	(working copy)
@@ -404,6 +404,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\ctl\ctlDefaultSecurityPanel.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\ctl\ctlSQLBox.cpp"
 				>
 			</File>
@@ -959,6 +963,10 @@
 					>
 				</File>
 				<File
+					RelativePath=".\include\ctl\ctlDefaultSecurityPanel.h"
+					>
+				</File>
+				<File
 					RelativePath=".\include\ctl\ctlSQLBox.h"
 					>
 				</File>
Index: dlg/dlgProperty.cpp
===================================================================
--- dlg/dlgProperty.cpp	(revision 8291)
+++ dlg/dlgProperty.cpp	(working copy)
@@ -22,6 +22,7 @@
 #include "utils/misc.h"
 #include "utils/pgDefs.h"
 #include "ctl/ctlSecurityPanel.h"
+#include "ctl/ctlDefaultSecurityPanel.h"
 
 // Images
 #include "images/properties.xpm"
@@ -59,17 +60,6 @@
 #include "schema/pgUser.h"
 
 
-class replClientData : public wxClientData
-{
-public:
-    replClientData(const wxString &c, long s, long ma, long mi) { cluster=c; setId=s; majorVer=ma; minorVer=mi; }
-    wxString cluster;
-    long setId;
-    long majorVer;
-    long minorVer;
-};
-
-
 void dataType::SetOid(OID id)
 {
     oid = id;
@@ -240,12 +230,6 @@
 }
 
 
-void dlgSecurityProperty::SetPrivilegesLayout()
-{
-    securityPage->lbPrivileges->GetParent()->Layout();
-}
-
-
 int dlgProperty::Go(bool modal)
 {
     wxASSERT(factory != 0);
@@ -1713,14 +1697,12 @@
 }
 
 
-
-
 wxString dlgSecurityProperty::GetGrant(const wxString &allPattern, const wxString &grantObject)
 {
     if (securityPage)
         return securityPage->GetGrant(allPattern, grantObject, &currentAcl);
     else
-    return wxString();
+        return wxString();
 }
 
 bool dlgSecurityProperty::DisablePrivilege(const wxString &priv) 
@@ -1735,6 +1717,162 @@
 /////////////////////////////////////////////////////////////////////////////
 
 
+BEGIN_EVENT_TABLE(dlgDefaultSecurityProperty, dlgSecurityProperty)
+    EVT_BUTTON(CTL_DEFADDPRIV, dlgDefaultSecurityProperty::OnAddPriv)
+    EVT_BUTTON(CTL_DEFDELPRIV, dlgDefaultSecurityProperty::OnDelPriv)
+#ifdef __WXMAC__
+    EVT_SIZE(                  dlgDefaultSecurityProperty::OnChangeSize)
+#endif
+END_EVENT_TABLE();
+
+
+dlgDefaultSecurityProperty::dlgDefaultSecurityProperty(pgaFactory *f, frmMain *frame, pgObject *obj, const wxString &resName, const wxString& privList, const char *privChar, bool createDefPrivPanel)
+  : dlgSecurityProperty(f, frame, obj, resName, privList, privChar), defaultSecurityChanged(false)
+{
+    if ((!obj || obj->CanCreate()) && createDefPrivPanel)
+    {
+        defaultSecurityPage = new ctlDefaultSecurityPanel(obj ? obj->GetConnection() : NULL, nbNotebook, frame->GetImageList());
+        if (obj && !obj->GetConnection()->BackendMinimumVersion(9, 0))
+            defaultSecurityPage->Disable();
+    }
+    else
+        defaultSecurityPage = NULL;
+}
+
+
+void dlgDefaultSecurityProperty::AddGroups(ctlComboBox *comboBox)
+{
+    if (!((securityPage && securityPage->cbGroups) || comboBox || defaultSecurityPage))
+        return;
+
+    pgSet *set=connection->ExecuteSet(wxT("SELECT groname FROM pg_group ORDER BY groname"));
+
+    if (set)
+    {
+        while (!set->Eof())
+        {
+            if (securityPage && securityPage->cbGroups)
+                securityPage->cbGroups->Append(wxT("group ") + set->GetVal(0));
+
+            if (comboBox)
+                comboBox->Append(set->GetVal(0));
+
+            if (defaultSecurityPage)
+                defaultSecurityPage->m_groups.Add(wxT("GROUP ") + set->GetVal(0));
+
+            set->MoveNext();
+        }
+        delete set;
+    }
+}
+
+
+void dlgDefaultSecurityProperty::AddUsers(ctlComboBox *combobox)
+{
+    if ((securityPage && securityPage->cbGroups) || defaultSecurityPage || combobox)
+    {
+        wxString strFetchUserQuery =
+            connection->BackendMinimumVersion(8, 1) ?
+              wxT("SELECT rolname FROM pg_roles WHERE rolcanlogin ORDER BY 1") :
+              wxT("SELECT usename FROM pg_user ORDER BY 1");
+
+        pgSet *set=connection->ExecuteSet(strFetchUserQuery);
+        if (set)
+        {
+            while (!set->Eof())
+            {
+                if (settings->GetShowUsersForPrivileges())
+                {
+                    if (securityPage && securityPage->cbGroups)
+                        securityPage->cbGroups->Append(set->GetVal(0));
+
+                    if (defaultSecurityPage)
+                        defaultSecurityPage->m_groups.Add(set->GetVal(0));
+                }
+
+                if (combobox)
+                    combobox->Append(set->GetVal(0));
+
+                set->MoveNext();
+            }
+        }
+    }
+}
+
+#ifdef __WXMAC__
+void dlgDefaultSecurityProperty::OnChangeSize(wxSizeEvent &ev)
+{
+    if (GetAutoLayout())
+    {
+        Layout();
+    }
+}
+#endif
+
+
+void dlgDefaultSecurityProperty::EnableOK(bool enable)
+{
+    // Don't enable the OK button if the object isn't yet created,
+    // leave that to the object dialog.
+    if (GetObject())
+    {
+        wxString sql=GetSql();
+        if (sql.IsEmpty())
+        {
+            enable=false;
+        }
+        else
+            enable=true;
+    }
+    dlgSecurityProperty::EnableOK(enable);
+}
+
+
+void dlgDefaultSecurityProperty::OnAddPriv(wxCommandEvent &ev)
+{
+    defaultSecurityChanged=true;
+    EnableOK(btnOK->IsEnabled());
+}
+
+
+void dlgDefaultSecurityProperty::OnDelPriv(wxCommandEvent &ev)
+{
+    defaultSecurityChanged=true;
+    EnableOK(btnOK->IsEnabled());
+}
+
+wxString dlgDefaultSecurityProperty::GetDefaultPrivileges(const wxString& schemaName)
+{
+    if (defaultSecurityChanged)
+        return defaultSecurityPage->GetDefaultPrivileges(schemaName);
+    return wxT("");
+}
+
+int dlgDefaultSecurityProperty::Go(bool modal, const wxString& schemaOid)
+{
+    if (defaultSecurityPage)
+        defaultSecurityPage->UpdatePrivilegePages(schemaOid);
+    return dlgSecurityProperty::Go(modal);
+}
+
+wxString dlgDefaultSecurityProperty::GetHelpPage() const
+{
+    int nDiff      = nbNotebook->GetPageCount() - nbNotebook->GetSelection();
+
+    switch (nDiff)
+    {
+    case 3:
+        return wxT("pg/sql-grant");
+    case 2:
+        return wxT("pg/sql-alterdefaultprivileges");
+    default:
+        return dlgProperty::GetHelpPage();
+    }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+
 BEGIN_EVENT_TABLE(dlgAgentProperty, dlgProperty)
     EVT_BUTTON (wxID_OK,                            dlgAgentProperty::OnOK)
 END_EVENT_TABLE();
@@ -2006,3 +2144,4 @@
     // so it's Good Enough (tm) for now.
     return obj != 0 && !obj->IsCreatedBy(serverFactory.GetCollectionFactory());
 }
+
Index: dlg/dlgDatabase.cpp
===================================================================
--- dlg/dlgDatabase.cpp	(revision 8291)
+++ dlg/dlgDatabase.cpp	(working copy)
@@ -19,6 +19,7 @@
 #include "utils/misc.h"
 #include "dlg/dlgDatabase.h"
 #include "schema/pgDatabase.h"
+#include "ctl/ctlDefaultSecurityPanel.h"
 
 
 // pointer to controls
@@ -47,13 +48,13 @@
     if (dlg && !node)
     {
         // use the server's connection to avoid "template1 in use"
-        dlg->connection=parent->GetConnection();
+        dlg->SetConnection(parent->GetConnection());
     }
     return dlg;
 }
 
 
-BEGIN_EVENT_TABLE(dlgDatabase, dlgSecurityProperty)
+BEGIN_EVENT_TABLE(dlgDatabase, dlgDefaultSecurityProperty)
     EVT_TEXT(XRCID("txtPath"),                      dlgProperty::OnChange)
     EVT_TEXT(XRCID("cbTablespace"),                 dlgProperty::OnChange)
     EVT_COMBOBOX(XRCID("cbTablespace"),             dlgProperty::OnChange)
@@ -77,7 +78,7 @@
 
 
 dlgDatabase::dlgDatabase(pgaFactory *f, frmMain *frame, pgDatabase *node)
-: dlgSecurityProperty(f, frame, node, wxT("dlgDatabase"), wxT("CREATE,TEMP,CONNECT"), "CTc")
+: dlgDefaultSecurityProperty(f, frame, node, wxT("dlgDatabase"), wxT("CREATE,TEMP,CONNECT"), "CTc", node != NULL ? true : false)
 {
     database=node;
     schemaRestrictionOk=true;
@@ -98,7 +99,7 @@
 {
     if (nbNotebook->GetSelection() == 1)
         return wxT("pg/runtime-config");
-    return dlgSecurityProperty::GetHelpPage();
+    return dlgDefaultSecurityProperty::GetHelpPage();
 }
 
 
@@ -110,10 +111,12 @@
     AddGroups(cbOwner);
     AddUsers(cbOwner);
 
-    if (connection->BackendMinimumVersion(8,5))
+    if (connection->BackendMinimumVersion(9, 0))
     {
         cbVarUsername->Append(wxT(""));
-        AddUsers(cbVarUsername);
+        // AddUsers function of dlgDefaultSecurity has already been called.
+        // Hence, calling dlgProperty::AddUsers instead of that.
+        dlgProperty::AddUsers(cbVarUsername);
     }
     else
         cbVarUsername->Enable(false);
@@ -162,7 +165,7 @@
 
         cbVarname->SetSelection(0);
 
-        if (connection->BackendMinimumVersion(8,5))
+        if (connection->BackendMinimumVersion(9, 0))
         {
             cbVarUsername->SetSelection(0);
         }
@@ -313,7 +316,7 @@
 
     SetupVarEditor(1);
 
-    return dlgSecurityProperty::Go(modal);
+    return dlgDefaultSecurityProperty::Go(modal);
 }
 
 
@@ -364,11 +367,75 @@
     {
         database->iSetSchemaRestriction(txtSchemaRestr->GetValue().Trim());
         settings->Write(wxString::Format(wxT("Servers/%d/Databases/%s/SchemaRestriction"), database->GetServer()->GetServerIndex(), database->GetName().c_str()), txtSchemaRestr->GetValue().Trim());
+
+        /*
+         * The connection from the database will get disconnected before execution of any
+         * sql statements for the database.
+         *
+         * Hence, we need to hack the execution of the default privileges statements(sqls)
+         * before getting disconnected from this database. So that, these statements will
+         * run against the current database connection, and not against the server connection.
+         */
+        // defaultSecurityChanged will be true only for PostgreSQL 9.0 or later
+        if (defaultSecurityChanged)
+        {
+            wxString strDefPrivs = GetDefaultPrivileges();
+            if (!executeDDLSql(strDefPrivs))
+            {
+                EnableOK(true);
+                return;
+            }
+            defaultSecurityChanged = false;
+        }
     }
-    dlgSecurityProperty::OnOK(ev);
+    dlgDefaultSecurityProperty::OnOK(ev);
 }
 
+/*
+ * Execute any ddl statement (sql)
+ *
+ * - Hacked to execute any DDL statement (sql) for dlgDatabse against this database, because
+ *   connection for this database object is getting disconnected, and replaced by the server
+ *   connection, before execution of any statements (sqls) in dlgPropery::apply function called
+ *   from dlgPropery::OnOK event handler.
+ */
+bool dlgDatabase::executeDDLSql(const wxString& strSql)
+{
+    pgConn *myConn = connection;
 
+    if (!strSql.IsEmpty())
+    {
+        wxString tmp;
+        if (cbClusterSet && cbClusterSet->GetSelection() > 0)
+        {
+            replClientData *data=(replClientData*)cbClusterSet->GetClientData(cbClusterSet->GetSelection());
+
+            if (data->majorVer > 1 || (data->majorVer == 1 && data->minorVer >= 2))
+            {
+                tmp = wxT("SELECT ") + qtIdent(data->cluster)
+                    + wxT(".ddlscript_prepare(") + NumToStr(data->setId) + wxT(", 0);\n")
+                    + wxT("SELECT ") + qtIdent(data->cluster)
+                    + wxT(".ddlscript_complete(") + NumToStr(data->setId) + wxT(", ")
+                    + qtDbString(strSql) + wxT(", 0);\n");
+            }
+            else
+            {
+                tmp = wxT("SELECT ") + qtIdent(data->cluster)
+                    + wxT(".ddlscript(") + NumToStr(data->setId) + wxT(", ")
+                    + qtDbString(strSql) + wxT(", 0);\n");
+            }
+        }
+        else
+            tmp = strSql;
+
+        if (!myConn->ExecuteVoid(tmp))
+            // error message is displayed inside ExecuteVoid
+            return false;
+    }
+    return true;
+}
+
+
 void dlgDatabase::CheckChange()
 {
     bool enable=true;
@@ -690,6 +757,9 @@
                     +  wxT(" RESET ") + varname + wxT(";\n");
             }
         }
+
+        if (connection->BackendMinimumVersion(9, 0) && defaultSecurityChanged)
+            sql += GetDefaultPrivileges();
     }
     else
     {
Index: dlg/dlgSchema.cpp
===================================================================
--- dlg/dlgSchema.cpp	(revision 8291)
+++ dlg/dlgSchema.cpp	(working copy)
@@ -21,7 +21,7 @@
 
 // pointer to controls
 
-BEGIN_EVENT_TABLE(dlgSchema, dlgSecurityProperty)
+BEGIN_EVENT_TABLE(dlgSchema, dlgDefaultSecurityProperty)
 END_EVENT_TABLE();
 
 dlgProperty *pgSchemaBaseFactory::CreateDialog(frmMain *frame, pgObject *node, pgObject *parent)
@@ -30,7 +30,7 @@
 }
 
 dlgSchema::dlgSchema(pgaFactory *f, frmMain *frame, pgSchema *node)
-: dlgSecurityProperty(f, frame, node, wxT("dlgSchema"), wxT("USAGE,CREATE"), "UC")
+: dlgDefaultSecurityProperty(f, frame, node, wxT("dlgSchema"), wxT("USAGE,CREATE"), "UC")
 {
     schema=node;
 }
@@ -44,6 +44,7 @@
 
 int dlgSchema::Go(bool modal)
 {
+    wxString schemaOid;
     if (!schema)
         cbOwner->Append(wxT(""));
 
@@ -52,7 +53,6 @@
     if (schema)
     {
         // edit mode
-
         if (!connection->BackendMinimumVersion(7, 5))
             cbOwner->Disable();
 
@@ -61,13 +61,14 @@
             cbOwner->Disable();
             txtName->Disable();
         }
+        schemaOid = schema->GetOidStr();
     }
     else
     {
         // create mode
     }
 
-    return dlgSecurityProperty::Go(modal);
+    return dlgDefaultSecurityProperty::Go(modal, schemaOid);
 }
 
 
@@ -115,26 +116,29 @@
 wxString dlgSchema::GetSql()
 {
     wxString sql, name;
-    name=GetName();
+    name = qtIdent(GetName());
 
     if (schema)
     {
         // edit mode
         AppendNameChange(sql);
-        AppendOwnerChange(sql, wxT("SCHEMA ") + qtIdent(name));
+        AppendOwnerChange(sql, wxT("SCHEMA ") + name);
     }
     else
     {
         // create mode
-        sql = wxT("CREATE SCHEMA ") + qtIdent(name);
+        sql = wxT("CREATE SCHEMA ") + name;
         AppendIfFilled(sql, wxT("\n       AUTHORIZATION "), qtIdent(cbOwner->GetValue()));
         sql += wxT(";\n");
 
     }
     AppendComment(sql, wxT("SCHEMA"), 0, schema);
 
-    sql += GetGrant(wxT("UC"), wxT("SCHEMA ") + qtIdent(name));
+    sql += GetGrant(wxT("UC"), wxT("SCHEMA ") + name);
 
+    if (connection->BackendMinimumVersion(9, 0) && defaultSecurityChanged)
+        sql += GetDefaultPrivileges(name);
+
     return sql;
 }
 
Index: ui/dlgSchema.xrc
===================================================================
--- ui/dlgSchema.xrc	(revision 8291)
+++ ui/dlgSchema.xrc	(working copy)
@@ -2,7 +2,7 @@
 <resource>
   <object class="wxDialog" name="dlgSchema">
     <title></title>
-    <size>220,250d</size>
+    <size>220,280d</size>
     <style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER|wxRESIZE_BOX|wxTHICK_FRAME</style>
     <object class="wxFlexGridSizer">
       <cols>1</cols>
@@ -10,7 +10,7 @@
       <growablecols>0</growablecols>
       <object class="sizeritem">
         <object class="wxNotebook" name="nbNotebook">
-          <size>216,225d</size>
+          <size>216,260d</size>
           <selected>0</selected>
           <object class="notebookpage">
             <label>Properties</label>
Index: ui/xrcDialogs.cpp
===================================================================
--- ui/xrcDialogs.cpp	(revision 8291)
+++ ui/xrcDialogs.cpp	(working copy)
@@ -2312,7 +2312,7 @@
 101,99,116,32,99,108,97,115,115,61,34,119,120,78,111,116,101,98,111,111,
 107,34,32,110,97,109,101,61,34,110,98,78,111,116,101,98,111,111,107,34,
 62,10,32,32,32,32,32,32,32,32,32,32,60,115,105,122,101,62,50,49,54,44,50,
-53,53,100,60,47,115,105,122,101,62,10,32,32,32,32,32,32,32,32,32,32,60,
+54,48,100,60,47,115,105,122,101,62,10,32,32,32,32,32,32,32,32,32,32,60,
 115,101,108,101,99,116,101,100,62,48,60,47,115,101,108,101,99,116,101,100,
 62,10,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,
 97,115,115,61,34,110,111,116,101,98,111,111,107,112,97,103,101,34,62,10,
@@ -15569,7 +15569,7 @@
 32,99,108,97,115,115,61,34,119,120,68,105,97,108,111,103,34,32,110,97,109,
 101,61,34,100,108,103,83,99,104,101,109,97,34,62,10,32,32,32,32,60,116,
 105,116,108,101,47,62,10,32,32,32,32,60,115,105,122,101,62,50,50,48,44,
-50,53,48,100,60,47,115,105,122,101,62,10,32,32,32,32,60,115,116,121,108,
+50,56,48,100,60,47,115,105,122,101,62,10,32,32,32,32,60,115,116,121,108,
 101,62,119,120,68,69,70,65,85,76,84,95,68,73,65,76,79,71,95,83,84,89,76,
 69,124,119,120,67,65,80,84,73,79,78,124,119,120,83,89,83,84,69,77,95,77,
 69,78,85,124,119,120,82,69,83,73,90,69,95,66,79,82,68,69,82,124,119,120,
@@ -15585,7 +15585,7 @@
 114,105,116,101,109,34,62,10,32,32,32,32,32,32,32,32,60,111,98,106,101,
 99,116,32,99,108,97,115,115,61,34,119,120,78,111,116,101,98,111,111,107,
 34,32,110,97,109,101,61,34,110,98,78,111,116,101,98,111,111,107,34,62,10,
-32,32,32,32,32,32,32,32,32,32,60,115,105,122,101,62,50,49,54,44,50,50,53,
+32,32,32,32,32,32,32,32,32,32,60,115,105,122,101,62,50,49,54,44,50,54,48,
 100,60,47,115,105,122,101,62,10,32,32,32,32,32,32,32,32,32,32,60,115,101,
 108,101,99,116,101,100,62,48,60,47,115,101,108,101,99,116,101,100,62,10,
 32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,
Index: ui/dlgDatabase.xrc
===================================================================
--- ui/dlgDatabase.xrc	(revision 8291)
+++ ui/dlgDatabase.xrc	(working copy)
@@ -10,7 +10,7 @@
       <growablecols>0</growablecols>
       <object class="sizeritem">
         <object class="wxNotebook" name="nbNotebook">
-          <size>216,255d</size>
+          <size>216,260d</size>
           <selected>0</selected>
           <object class="notebookpage">
             <label>Properties</label>
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to