From 57687faa3158da69f38ea7363dc4fde367102af9 Mon Sep 17 00:00:00 2001 From: "Jehan-Guillaume (ioguix) de Rorthais" Date: Mon, 17 Sep 2012 16:44:10 +0200 Subject: [PATCH] Fix bug where new autovacuum setup for a table was failing Fix a bug INSERT SQL that was using 'WHERE' (?!) --- classes/database/Postgres83.php | 6 ++---- 1 file 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'], -- 2.39.5