SVN Commit by andreas: r4521 - trunk/pgadmin3/src/dlg - Mailing list pgadmin-hackers

From svn@pgadmin.org
Subject SVN Commit by andreas: r4521 - trunk/pgadmin3/src/dlg
Date
Msg-id 200510071110.j97BAbuG019095@developer.pgadmin.org
Whole thread Raw
List pgadmin-hackers
Author: andreas
Date: 2005-10-07 12:10:37 +0100 (Fri, 07 Oct 2005)
New Revision: 4521

Modified:
   trunk/pgadmin3/src/dlg/dlgTable.cpp
Log:
Fix autovacuum for < pgsql8.1

Modified: trunk/pgadmin3/src/dlg/dlgTable.cpp
===================================================================
--- trunk/pgadmin3/src/dlg/dlgTable.cpp    2005-10-07 11:00:23 UTC (rev 4520)
+++ trunk/pgadmin3/src/dlg/dlgTable.cpp    2005-10-07 11:10:37 UTC (rev 4521)
@@ -532,43 +532,46 @@
                     + wxT(";\n");
         }

-        if (!chkCustomVac->GetValue())
+        if (connection->BackendMinimumVersion(8,1))
         {
-            if (hasVacuum)
-                sql += wxT("DELETE FROM pg_autovacuum WHERE vacrelid=") + table->GetOidStr() + wxT(";\n");
-        }
-        else
-        {
-            wxString vacStr;
-            bool changed = (chkVacEnabled->GetValue() != tableVacEnabled);
-            if (!hasVacuum)
+            if (!chkCustomVac->GetValue())
             {
-                vacStr = wxT("INSERT INTO pg_autovacuum(vacrelid, enabled, vac_base_thresh, anl_base_thresh,
vac_scale_factor,anl_scale_factor, vac_cost_delay, vac_cost_limit)") 
-                         wxT("\n   VALUES(")
-                       + table->GetOidStr() + wxT(", ")
-                       + BoolToStr(chkVacEnabled->GetValue()) + wxT(", ")
-                       + AppendNum(changed, txtBaseVac, tableVacBaseThr) + wxT(", ")
-                       + AppendNum(changed, txtBaseAn, tableAnlBaseThr) + wxT(", ")
-                       + AppendNum(changed, txtFactorVac, tableVacFactor) + wxT(", ")
-                       + AppendNum(changed, txtFactorAn, tableAnlFactor) + wxT(", ")
-                       + AppendNum(changed, txtVacDelay, tableCostDelay) + wxT(", ")
-                       + AppendNum(changed, txtVacLimit, tableCostLimit) + wxT(");\n");
+                if (hasVacuum)
+                    sql += wxT("DELETE FROM pg_autovacuum WHERE vacrelid=") + table->GetOidStr() + wxT(";\n");
             }
             else
             {
-                vacStr = wxT("UPDATE pg_autovacuum\n")
-                         wxT("   SET enabled=")
-                       + BoolToStr(chkVacEnabled->GetValue())
-                       + wxT(", vac_base_thresh = ") + AppendNum(changed, txtBaseVac, tableVacBaseThr)
-                       + wxT(", anl_base_thresh = ") + AppendNum(changed, txtBaseAn, tableAnlBaseThr)
-                       + wxT(", base_scale_factor = ") + AppendNum(changed, txtFactorVac, tableVacFactor)
-                       + wxT(", anl_scale_factor = ") + AppendNum(changed, txtFactorAn, tableAnlFactor)
-                       + wxT(", vac_cost_delay = ") + AppendNum(changed, txtVacDelay, tableCostDelay)
-                       + wxT(", vac_cost_limit = ") + AppendNum(changed, txtVacLimit, tableCostLimit)
-                       + wxT("\n WHERE vacrelid=") + table->GetOidStr() + wxT(";\n");
+                wxString vacStr;
+                bool changed = (chkVacEnabled->GetValue() != tableVacEnabled);
+                if (!hasVacuum)
+                {
+                    vacStr = wxT("INSERT INTO pg_autovacuum(vacrelid, enabled, vac_base_thresh, anl_base_thresh,
vac_scale_factor,anl_scale_factor, vac_cost_delay, vac_cost_limit)") 
+                             wxT("\n   VALUES(")
+                           + table->GetOidStr() + wxT(", ")
+                           + BoolToStr(chkVacEnabled->GetValue()) + wxT(", ")
+                           + AppendNum(changed, txtBaseVac, tableVacBaseThr) + wxT(", ")
+                           + AppendNum(changed, txtBaseAn, tableAnlBaseThr) + wxT(", ")
+                           + AppendNum(changed, txtFactorVac, tableVacFactor) + wxT(", ")
+                           + AppendNum(changed, txtFactorAn, tableAnlFactor) + wxT(", ")
+                           + AppendNum(changed, txtVacDelay, tableCostDelay) + wxT(", ")
+                           + AppendNum(changed, txtVacLimit, tableCostLimit) + wxT(");\n");
+                }
+                else
+                {
+                    vacStr = wxT("UPDATE pg_autovacuum\n")
+                             wxT("   SET enabled=")
+                           + BoolToStr(chkVacEnabled->GetValue())
+                           + wxT(", vac_base_thresh = ") + AppendNum(changed, txtBaseVac, tableVacBaseThr)
+                           + wxT(", anl_base_thresh = ") + AppendNum(changed, txtBaseAn, tableAnlBaseThr)
+                           + wxT(", base_scale_factor = ") + AppendNum(changed, txtFactorVac, tableVacFactor)
+                           + wxT(", anl_scale_factor = ") + AppendNum(changed, txtFactorAn, tableAnlFactor)
+                           + wxT(", vac_cost_delay = ") + AppendNum(changed, txtVacDelay, tableCostDelay)
+                           + wxT(", vac_cost_limit = ") + AppendNum(changed, txtVacLimit, tableCostLimit)
+                           + wxT("\n WHERE vacrelid=") + table->GetOidStr() + wxT(";\n");
+                }
+                if (changed)
+                    sql += vacStr;
             }
-            if (changed)
-                sql += vacStr;
         }
     }
     else
@@ -634,11 +637,6 @@
         sql += wxT(";\n");

         AppendOwnerNew(sql, wxT("TABLE ") + tabname);
-
-        if (connection->BackendMinimumVersion(8, 1))
-        {
-
-        }
     }

     // Extra column info


pgadmin-hackers by date:

Previous
From: svn@pgadmin.org
Date:
Subject: SVN Commit by dpage: r4520 - trunk/pgadmin3/src
Next
From: "Aftab Alam"
Date:
Subject: mailling list