From: Jehan-Guillaume (ioguix) de Rorthais Date: Mon, 17 Sep 2012 14:44:10 +0000 (+0200) Subject: Fix bug where new autovacuum setup for a table was failing X-Git-Tag: REL_5-1-0~34 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=57687faa3158da69f38ea7363dc4fde367102af9;p=phppgadmin.git Fix bug where new autovacuum setup for a table was failing Fix a bug INSERT SQL that was using 'WHERE' (?!) --- 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'],