Le 03/08/2010 22:08, Guillaume Lelarge a écrit :
> Le 03/08/2010 21:50, Little, Douglas a écrit :
>> 325 logon roles, 24 groups
>>
>
> I suppose some of them don't have a ressource queue configured.
>
> BTW, please, don't top-post.
>
If you can compile it on windows, here is a patch that should fix this.
I can't test it because I don't have a Greenplum database.
--
Guillaume
http://www.postgresql.fr
http://dalibo.com
diff --git a/pgadmin/schema/pgRole.cpp b/pgadmin/schema/pgRole.cpp
index e1d9601..65e6e41 100644
--- a/pgadmin/schema/pgRole.cpp
+++ b/pgadmin/schema/pgRole.cpp
@@ -356,6 +356,7 @@ pgObject *pgRoleBaseFactory::CreateObjects(pgCollection *collection, ctlTree *br
{
pgRole *role=0;
pgSet *roles=0;
+ wxString query;
wxString tabname;
@@ -366,16 +367,29 @@ pgObject *pgRoleBaseFactory::CreateObjects(pgCollection *collection, ctlTree *br
// In 8.5+, role config options are in pg_db_role_setting
if (collection->GetServer()->GetConnection()->BackendMinimumVersion(8, 5))
- roles = collection->GetServer()->ExecuteSet(wxT("SELECT tab.oid, tab.*, pg_catalog.shobj_description(tab.oid, 'pg_authid') AS description, setting.setconfig AS rolconfig FROM ") +
- tabname + wxT(" tab") +
+ {
+ query = wxT("SELECT tab.oid, tab.*, pg_catalog.shobj_description(tab.oid, 'pg_authid') AS description, setting.setconfig AS rolconfig");
+ if (collection->GetServer()->GetConnection()->GetIsGreenplum())
+ query += wxT(", (SELECT rsqname FROM pg_resqueue WHERE pg_resqueue.oid = rolresqueue) AS rsqname");
+ query += wxT(" FROM ") + tabname + wxT(" tab") +
wxT(" LEFT OUTER JOIN pg_db_role_setting setting ON (tab.oid=setting.setrole AND setting.setdatabase=0)\n") +
- restriction + wxT(" ORDER BY rolname"));
+ restriction + wxT(" ORDER BY rolname");
+ }
else if (collection->GetServer()->GetConnection()->BackendMinimumVersion(8, 2))
- roles = collection->GetServer()->ExecuteSet(wxT("SELECT oid, *, pg_catalog.shobj_description(oid, 'pg_authid') AS description FROM ")
- + tabname + restriction + wxT(" ORDER BY rolname"));
+ {
+ query = wxT("SELECT oid, *, pg_catalog.shobj_description(oid, 'pg_authid') AS description ");
+ if (collection->GetServer()->GetConnection()->GetIsGreenplum())
+ query += wxT(", (SELECT rsqname FROM pg_resqueue WHERE pg_resqueue.oid = rolresqueue) AS rsqname");
+ query += wxT(" FROM ") + tabname + restriction + wxT(" ORDER BY rolname");
+ }
else
- roles = collection->GetServer()->ExecuteSet(wxT("SELECT oid, *, '' AS description FROM ")
- + tabname + restriction + wxT(" ORDER BY rolname"));
+ {
+ query = wxT("SELECT oid, *, '' AS description ") ;
+ if (collection->GetServer()->GetConnection()->GetIsGreenplum())
+ query += wxT(", (SELECT rsqname FROM pg_resqueue WHERE pg_resqueue.oid = rolresqueue) AS rsqname");
+ query += wxT(" FROM ") + tabname + restriction + wxT(" ORDER BY rolname");
+ }
+ roles = collection->GetServer()->ExecuteSet(query);
if (roles)
{
@@ -400,14 +414,9 @@ pgObject *pgRoleBaseFactory::CreateObjects(pgCollection *collection, ctlTree *br
if (collection->GetServer()->GetConnection()->GetIsGreenplum())
{
- Oid rolresqueue = roles->GetOid(wxT("rolresqueue"));
- if (rolresqueue != 0)
- {
- role->iSetRolQueueName(collection->GetServer()->ExecuteScalar(wxT("SELECT rsqname FROM pg_resqueue WHERE pg_resqueue.oid = ") + roles->GetVal(wxT("rolresqueue"))));
- }
+ role->iSetRolQueueName(roles->GetVal(wxT("rsqname")));
}
-
wxString cfg=roles->GetVal(wxT("rolconfig"));
if (!cfg.IsEmpty())
FillArray(role->GetConfigList(), cfg.Mid(1, cfg.Length()-2));
--
Sent via pgadmin-support mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support