Display partition hierarchy correctly on Greenplum. [Chuck McDevitt]
authordpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Tue, 5 May 2009 09:28:18 +0000 (09:28 +0000)
committerdpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Tue, 5 May 2009 09:28:18 +0000 (09:28 +0000)
git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@7836 a7884b65-44f6-0310-8a51-81a127f17b15

pgadmin/include/schema/gpPartition.h
pgadmin/schema/gpPartition.cpp

index f24912c43d6ba6a018721c06a2b8d2ccdc0e0f26..308952be322949b75cc20a8a00351745f39f6a4b 100644 (file)
@@ -38,6 +38,11 @@ public:
     wxMenu * GetNewMenu();
     wxString GetSql(ctlTree *browser);
     pgObject *Refresh(ctlTree *browser, const wxTreeItemId item);
+    wxString GetPartitionName() { return partitionname; }
+    void iSetPartitionName(const wxString& pn) { partitionname = pn; }
+
+private:
+    wxString partitionname;
 };
 
 
index 958f4572e30767e6664bee9bb7ab4d7dbe88b664..282e1d337c0e92e4d7b51b584fe9b8f42f05a279 100644 (file)
@@ -109,7 +109,7 @@ pgObject *gpPartitionFactory::CreateObjects(pgCollection *coll, ctlTree *browser
        pgSet *tables;
 
        query= wxT("SELECT rel.oid, relname, rel.reltablespace AS spcoid, spcname, pg_get_userbyid(relowner) AS relowner, relacl, relhasoids, ")
-               wxT("relhassubclass, reltuples, description, conname, conkey,\n")
+               wxT("relhassubclass, reltuples, description, conname, conkey, parname, \n")
                wxT("       EXISTS(select 1 FROM pg_trigger\n")
                wxT("                       JOIN pg_proc pt ON pt.oid=tgfoid AND pt.proname='logtrigger'\n")
                wxT("                       JOIN pg_proc pc ON pc.pronamespace=pt.pronamespace AND pc.proname='slonyversion'\n")
@@ -129,11 +129,13 @@ pgObject *gpPartitionFactory::CreateObjects(pgCollection *coll, ctlTree *browser
 
 
        query += wxT("  FROM pg_class rel JOIN pg_partition_rule pr ON(rel.oid = pr.parchildrelid) JOIN pg_partition p ON (pr.paroid = p.oid)\n")
+        wxT("  JOIN pg_inherits i ON (rel.oid = i.inhrelid) \n")
                wxT("  LEFT OUTER JOIN pg_tablespace ta on ta.oid=rel.reltablespace\n")
                wxT("  LEFT OUTER JOIN pg_description des ON (des.objoid=rel.oid AND des.objsubid=0)\n")
                wxT("  LEFT OUTER JOIN pg_constraint c ON c.conrelid=rel.oid AND c.contype='p'\n");
        query += wxT("  LEFT OUTER JOIN gp_distribution_policy gpd ON gpd.localoid=rel.oid\n");
-       query += wxT(" WHERE relkind = 'r' AND p.parrelid = ") + collection->GetOidStr() + wxT("\n");
+       query += wxT(" WHERE relkind = 'r' ");
+    query += wxT(" AND i.inhparent = ") + collection->GetOidStr() + wxT("\n"); 
 
        query += restriction + 
                wxT(" ORDER BY relname");
@@ -167,6 +169,7 @@ pgObject *gpPartitionFactory::CreateObjects(pgCollection *coll, ctlTree *browser
                        table->iSetFillFactor(tables->GetVal(wxT("fillfactor")));
 
                        table->iSetHasSubclass(tables->GetBool(wxT("relhassubclass")));
+            table->iSetPartitionName(tables->GetVal(wxT("parname")));
                        table->iSetPrimaryKeyName(tables->GetVal(wxT("conname")));
                        table->iSetIsReplicated(tables->GetBool(wxT("isrepl")));
                        wxString cn=tables->GetVal(wxT("conkey"));