Hi, This 9.1 new feature is supported with this patch. It takes care of the table property tab, table dialog, and pg_dump window.
Comments? -- Guillaume http://www.postgresql.fr http://dalibo.com
diff --git a/pgadmin/dlg/dlgTable.cpp b/pgadmin/dlg/dlgTable.cpp index 322fae0..beced24 100644 --- a/pgadmin/dlg/dlgTable.cpp +++ b/pgadmin/dlg/dlgTable.cpp @@ -34,6 +34,8 @@ #include "schema/pgDatatype.h" +#define stUnlogged CTRL_STATIC("stUnlogged") +#define chkUnlogged CTRL_CHECKBOX("chkUnlogged") #define stHasOids CTRL_STATIC("stHasOids") #define chkHasOids CTRL_CHECKBOX("chkHasOids") #define lbTables CTRL_LISTBOX("lbTables") @@ -100,7 +102,7 @@ BEGIN_EVENT_TABLE(dlgTable, dlgSecurityProperty) - EVT_CHECKBOX(XRCID("chkHasOids"), dlgProperty::OnChange) + EVT_CHECKBOX(XRCID("chkUnlogged"), dlgProperty::OnChange) EVT_TEXT(XRCID("cbTablespace"), dlgProperty::OnChange) EVT_COMBOBOX(XRCID("cbTablespace"), dlgProperty::OnChange) EVT_COMBOBOX(XRCID("cbOfType"), dlgTable::OnChangeOfType) @@ -225,6 +227,7 @@ int dlgTable::Go(bool modal) if (table) { // edit mode + chkUnlogged->SetValue(table->GetUnlogged()); chkHasOids->SetValue(table->GetHasOids()); if (table->GetTablespaceOid() != 0) @@ -246,6 +249,7 @@ int dlgTable::Go(bool modal) btnAddTable->Enable(connection->BackendMinimumVersion(8, 2) && cbTables->GetGuessedSelection() >= 0); lbTables->Enable(connection->BackendMinimumVersion(8, 2)); chkHasOids->Enable(table->GetHasOids() && connection->BackendMinimumVersion(8, 0)); + chkUnlogged->Enable(false); cbTablespace->Enable(connection->BackendMinimumVersion(7, 5)); wxCookieType cookie; @@ -1216,7 +1220,10 @@ wxString dlgTable::GetSql() else { bool typedTable = cbOfType->GetCurrentSelection() > 0 && cbOfType->GetOIDKey() > 0; - sql = wxT("CREATE TABLE ") + tabname; + sql = wxT("CREATE "); + if (chkUnlogged->GetValue()) + sql += wxT("UNLOGGED "); + sql += wxT("TABLE ") + tabname; if (typedTable) sql += wxT("\nOF ") + qtIdent(cbOfType->GetValue()); diff --git a/pgadmin/frm/frmBackup.cpp b/pgadmin/frm/frmBackup.cpp index 6065994..73582bd 100644 --- a/pgadmin/frm/frmBackup.cpp +++ b/pgadmin/frm/frmBackup.cpp @@ -51,17 +51,18 @@ #define chkUseSetSession CTRL_CHECKBOX("chkUseSetSession") #define chkForceQuoteForIdent CTRL_CHECKBOX("chkForceQuoteForIdent") #define ctvObjects CTRL_CHECKTREEVIEW("ctvObjects") +#define chkNoUnloggedTableData CTRL_CHECKBOX("chkNoUnloggedTableData") BEGIN_EVENT_TABLE(frmBackup, ExternProcessDialog) - EVT_TEXT(XRCID("txtFilename"), frmBackup::OnChange) - EVT_BUTTON(XRCID("btnFilename"), frmBackup::OnSelectFilename) - EVT_BUTTON(wxID_OK, frmBackup::OnOK) - EVT_RADIOBOX(XRCID("rbxFormat"), frmBackup::OnChangePlain) - EVT_CHECKBOX(XRCID("chkOnlyData"), frmBackup::OnChangePlain) - EVT_CHECKBOX(XRCID("chkOnlySchema"), frmBackup::OnChangePlain) - EVT_CHECKBOX(XRCID("chkNoOwner"), frmBackup::OnChangePlain) - EVT_CLOSE( ExternProcessDialog::OnClose) + EVT_TEXT(XRCID("txtFilename"), frmBackup::OnChange) + EVT_BUTTON(XRCID("btnFilename"), frmBackup::OnSelectFilename) + EVT_BUTTON(wxID_OK, frmBackup::OnOK) + EVT_RADIOBOX(XRCID("rbxFormat"), frmBackup::OnChangePlain) + EVT_CHECKBOX(XRCID("chkOnlyData"), frmBackup::OnChangePlain) + EVT_CHECKBOX(XRCID("chkOnlySchema"), frmBackup::OnChangePlain) + EVT_CHECKBOX(XRCID("chkNoUnloggedTableData"), frmBackup::OnChangePlain) + EVT_CLOSE( ExternProcessDialog::OnClose) END_EVENT_TABLE() @@ -186,9 +187,10 @@ frmBackup::frmBackup(frmMain *form, pgObject *obj) : ExternProcessDialog(form) delete objects; } - if (!pgAppMinimumVersion(backupExecutable, 9,1)) + if (!pgAppMinimumVersion(backupExecutable, 9, 1)) { chkForceQuoteForIdent->Disable(); + chkNoUnloggedTableData->Disable(); } if (!pgAppMinimumVersion(backupExecutable, 8, 4)) { @@ -408,6 +410,8 @@ wxString frmBackup::getCmdPart2() cmd.Append(wxT(" --verbose")); if (chkForceQuoteForIdent->GetValue()) cmd.Append(wxT(" --quote-all-identifiers")); + if (chkNoUnloggedTableData->GetValue()) + cmd.Append(wxT(" --no-unlogged-table-data")); cmd.Append(wxT(" --file \"") + txtFilename->GetValue() + wxT("\"")); diff --git a/pgadmin/include/schema/pgTable.h b/pgadmin/include/schema/pgTable.h index 64f0778..9d3de1c 100644 --- a/pgadmin/include/schema/pgTable.h +++ b/pgadmin/include/schema/pgTable.h @@ -56,6 +56,8 @@ public: bool GetHasOids() const { return hasOids; } void iSetHasOids(bool b) { hasOids=b; } + bool GetUnlogged() const { return unlogged; } + void iSetUnlogged(bool b) { unlogged=b; } wxString GetPrimaryKey() const { return primaryKey; } void iSetPrimaryKey(const wxString& s) {primaryKey = s; } wxString GetQuotedPrimaryKey() const { return quotedPrimaryKey; } @@ -221,7 +223,7 @@ private: wxString checksum; wxString partitionDef; bool isPartitioned; - bool hasOids, hasSubclass, rowsCounted, isReplicated, showExtendedStatistics, distributionIsRandom; + bool hasOids, unlogged, hasSubclass, rowsCounted, isReplicated, showExtendedStatistics, distributionIsRandom; wxString toast_fillFactor, toast_autovacuum_vacuum_threshold, toast_autovacuum_vacuum_scale_factor, toast_autovacuum_analyze_threshold, diff --git a/pgadmin/schema/pgTable.cpp b/pgadmin/schema/pgTable.cpp index 7611855..75856ca 100644 --- a/pgadmin/schema/pgTable.cpp +++ b/pgadmin/schema/pgTable.cpp @@ -300,7 +300,10 @@ wxString pgTable::GetSql(ctlTree *browser) ShowTreeDetail(browser); sql = wxT("-- Table: ") + GetQuotedFullIdentifier() + wxT("\n\n") + wxT("-- DROP TABLE ") + GetQuotedFullIdentifier() + wxT(";") - + wxT("\n\nCREATE TABLE ") + GetQuotedFullIdentifier(); + + wxT("\n\nCREATE "); + if (GetUnlogged()) + sql += wxT("UNLOGGED "); + sql += wxT("TABLE ") + GetQuotedFullIdentifier(); // of type (9.0 material) if (ofTypeOid > 0) @@ -999,6 +1002,8 @@ void pgTable::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *prope properties->AppendItem(_("Inherited tables count"), GetInheritedTableCount()); if (GetInheritedTableCount()) properties->AppendItem(_("Inherited tables"), GetInheritedTables()); + if (GetConnection()->BackendMinimumVersion(9, 1)) + properties->AppendItem(_("Unlogged?"), GetUnlogged()); properties->AppendItem(_("Has OIDs?"), GetHasOids()); properties->AppendItem(_("System table?"), GetSystemObject()); @@ -1401,6 +1406,8 @@ pgObject *pgTableFactory::CreateObjects(pgCollection *collection, ctlTree *brows 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") wxT(" WHERE tgrelid=rel.oid) AS isrepl\n"); + if (collection->GetConnection()->BackendMinimumVersion(9, 1)) + query += wxT(", relpersistence \n"); if (collection->GetConnection()->BackendMinimumVersion(8, 2)) query += wxT(", substring(array_to_string(rel.reloptions, ',') from 'fillfactor=([0-9]*)') AS fillfactor \n"); if (collection->GetConnection()->GetIsGreenplum()) @@ -1505,6 +1512,8 @@ pgObject *pgTableFactory::CreateObjects(pgCollection *collection, ctlTree *brows table->iSetOfType(wxT("")); } table->iSetComment(tables->GetVal(wxT("description"))); + if (collection->GetConnection()->BackendMinimumVersion(9, 1)) + table->iSetUnlogged(tables->GetVal(wxT("relpersistence")) == wxT("u")); table->iSetHasOids(tables->GetBool(wxT("relhasoids"))); table->iSetEstimatedRows(tables->GetDouble(wxT("reltuples")) * gp_segments); if (collection->GetConnection()->BackendMinimumVersion(8, 2)) { diff --git a/pgadmin/ui/dlgTable.xrc b/pgadmin/ui/dlgTable.xrc index b868a31..0af2c99 100644 --- a/pgadmin/ui/dlgTable.xrc +++ b/pgadmin/ui/dlgTable.xrc @@ -17,10 +17,10 @@ <object class="wxPanel" name="pnlProperties"> <object class="wxFlexGridSizer"> <cols>2</cols> - <rows>9</rows> + <rows>10</rows> <vgap>5</vgap> <hgap>5</hgap> - <growablerows>7</growablerows> + <growablerows>8</growablerows> <growablecols>1</growablecols> <object class="sizeritem"> <object class="wxStaticText" name="stName"> @@ -119,6 +119,21 @@ <border>4</border> </object> <object class="sizeritem"> + <object class="wxStaticText" name="stUnlogged"> + <label>Unlogged</label> + </object> + <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag> + <border>4</border> + </object> + <object class="sizeritem"> + <object class="wxCheckBox" name="chkUnlogged"> + <label></label> + <checked>0</checked> + </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> diff --git a/pgadmin/ui/frmBackup.xrc b/pgadmin/ui/frmBackup.xrc index 845dede..5a89a92 100644 --- a/pgadmin/ui/frmBackup.xrc +++ b/pgadmin/ui/frmBackup.xrc @@ -2,7 +2,7 @@ <resource> <object class="wxDialog" name="frmBackup"> <title>Backup</title> - <size>300,213d</size> + <size>300,233d</size> <style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER|wxRESIZE_BOX|wxTHICK_FRAME</style> <object class="wxFlexGridSizer"> <cols>1</cols> @@ -12,7 +12,7 @@ <object class="sizeritem"> <object class="wxNotebook" name="nbNotebook"> <pos>2,2d</pos> - <size>285,204d</size> + <size>285,224d</size> <style>wxNB_BOTTOM</style> <object class="notebookpage"> <label>File Options</label> @@ -169,7 +169,7 @@ <object class="wxStaticBoxSizer"> <label>Don't save</label> <cols>1</cols> - <rows>3</rows> + <rows>4</rows> <vgap>5</vgap> <hgap>5</hgap> <growablecols>0</growablecols> @@ -195,6 +195,13 @@ <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag> <border>4</border> </object> + <object class="sizeritem"> + <object class="wxCheckBox" name="chkNoUnloggedTableData"> + <label>Unlogged table data</label> + </object> + <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag> + <border>4</border> + </object> </object> <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag> <border>4</border>
-- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers