summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehan-Guillaume (ioguix) de Rorthais2012-09-17 14:44:10 +0000
committerJehan-Guillaume (ioguix) de Rorthais2012-09-17 14:44:10 +0000
commit57687faa3158da69f38ea7363dc4fde367102af9 (patch)
tree7f720f45117fe34c2f77626ae9dd88a8482b9fd2
parentb6231da5baa1b458eee8f944b92ed35182487e78 (diff)
Fix bug where new autovacuum setup for a table was failing
Fix a bug INSERT SQL that was using 'WHERE' (?!)
-rw-r--r--classes/database/Postgres83.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/classes/database/Postgres83.php b/classes/database/Postgres83.php
index 62544fa6..cc80e65e 100644
--- a/classes/database/Postgres83.php
+++ b/classes/database/Postgres83.php
@@ -204,7 +204,7 @@ class Postgres83 extends Postgres84 {
WHERE vacrelid = {$toid};");
$status = -1; // ini
- if (isset($rs->fields['vacrelid']) and ($rs->fields['vacrelid'] == $toid)) {
+ if ($rs->recordCount() and ($rs->fields['vacrelid'] == $toid)) {
// table exists in pg_autovacuum, UPDATE
$sql = sprintf("UPDATE \"pg_catalog\".\"pg_autovacuum\" SET
enabled = '%s',
@@ -233,9 +233,7 @@ class Postgres83 extends Postgres84 {
else {
// table doesn't exists in pg_autovacuum, INSERT
$sql = sprintf("INSERT INTO \"pg_catalog\".\"pg_autovacuum\"
- VALUES (%s, '%s', %s, %s, %s, %s, %s, %s, %s, %s )
- WHERE
- c.relname = '{$table}' AND n.nspname = '{$c_schema}';",
+ VALUES (%s, '%s', %s, %s, %s, %s, %s, %s, %s, %s )",
$toid,
($_POST['autovacuum_enabled'] == 'on')? 't':'f',
$_POST['autovacuum_vacuum_threshold'],