Permalink
Browse files

Fix bug with getProcesses with 9.2

  • Loading branch information...
1 parent fa610be commit d571ecae7b73bb3bd1acdc2b84c230c9b623154c @ioguix ioguix committed Sep 21, 2012
Showing with 21 additions and 16 deletions.
  1. +7 −4 classes/database/Postgres.php
  2. +11 −6 classes/database/Postgres91.php
  3. +3 −6 database.php
@@ -7196,12 +7196,15 @@ function dropAutovacuum($table) {
*/
function getProcesses($database = null) {
if ($database === null)
- $sql = "SELECT * FROM pg_catalog.pg_stat_activity ORDER BY datname, usename, pid";
+ $sql = "SELECT datname, usename, pid, query, query_start
+ FROM pg_catalog.pg_stat_activity
+ ORDER BY datname, usename, pid";
else {
$this->clean($database);
- $sql = "
- SELECT * FROM pg_catalog.pg_stat_activity
- WHERE datname='{$database}' ORDER BY usename, pid";
+ $sql = "SELECT datname, usename, pid, query, query_start
+ FROM pg_catalog.pg_stat_activity
+ WHERE datname='{$database}'
+ ORDER BY usename, pid";
}
return $this->selectSet($sql);
@@ -35,15 +35,20 @@ function getHelpPages() {
*/
function getProcesses($database = null) {
if ($database === null)
- $sql = "SELECT * FROM pg_catalog.pg_stat_activity ORDER BY datname, usename, procpid";
+ $sql = "SELECT datname, usename, procpid AS pid, current_query AS query, query_start
+ FROM pg_catalog.pg_stat_activity
+ ORDER BY datname, usename, procpid";
else {
- $this->clean($database);
- $sql = "
- SELECT * FROM pg_catalog.pg_stat_activity
- WHERE datname='{$database}' ORDER BY usename, procpid";
+ //$this->clean($database);
+ $sql = "SELECT datname, usename, procpid AS pid, current_query AS query, query_start
+ FROM pg_catalog.pg_stat_activity
+ -- WHERE datname='{$database}'
+ ORDER BY usename, procpid";
}
- return $this->selectSet($sql);
+ $rc = $this->selectSet($sql);
+
+ return $rc;
}
// Tablespace functions
View
@@ -435,19 +435,19 @@ function currentProcesses($isAjax = false) {
// Fetch the processes from the database
echo "<h3>{$lang['strprocesses']}</h3>\n";
$processes = $data->getProcesses($_REQUEST['database']);
-
+
$columns = array(
'user' => array(
'title' => $lang['strusername'],
'field' => field('usename'),
),
'process' => array(
'title' => $lang['strprocess'],
- 'field' => field('procpid'),
+ 'field' => field('pid'),
),
'query' => array(
'title' => $lang['strsql'],
- 'field' => field('current_query'),
+ 'field' => field('query'),
),
'start_time' => array(
'title' => $lang['strstarttime'],
@@ -496,9 +496,6 @@ function currentProcesses($isAjax = false) {
if (count($actions) == 0) unset($columns['actions']);
- // Remove query start time for <7.4
- if (!isset($processes->fields['query_start'])) unset($columns['start_time']);
-
$misc->printTable($processes, $columns, $actions, 'database-processes', $lang['strnodata']);
if ($isAjax) exit;

0 comments on commit d571eca

Please sign in to comment.