diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ddb54ee307..1a3becc807 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2012-03-31 Junichi Satoh + + * extensions/users_connected.php, extensions/module_groups.php: Fixed + SQL error with PostgreSQL. + 2012-03-31 Junichi Satoh * include/functions_graph.php: Fixed SQL error with PostgreSQL. diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index 94038469bb..9d36cc4c06 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -101,7 +101,6 @@ function mainModuleGroups() { //The big query switch ($config["dbtype"]) { case "mysql": - case "postgresql": $sql = "SELECT COUNT(id_agente) AS count, estado FROM tagente_estado WHERE utimestamp != 0 AND id_agente IN @@ -112,6 +111,17 @@ function mainModuleGroups() { WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE) GROUP BY estado"; break; + case "postgresql": + $sql = "SELECT COUNT(id_agente) AS count, estado + FROM tagente_estado + WHERE utimestamp != 0 AND id_agente IN + (SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled = 0) + AND id_agente_modulo IN + (SELECT id_agente_modulo + FROM tagente_modulo + WHERE id_module_group = %d AND disabled = 0 AND delete_pending = 0) + GROUP BY estado"; + break; case "oracle": $sql = "SELECT COUNT(id_agente) AS count, estado FROM tagente_estado diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 28ea2eae26..61e5fde474 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -39,7 +39,7 @@ function users_extension_main_god ($god = true) { case "postgresql": $sql = "SELECT id_usuario, ip_origen, fecha, accion FROM tsesion - WHERE descripcion = '" . io_safe_input('Logged in') . "' AND utimestamp > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - 3600) GROUP BY id_usuario, ip_origen, accion"; + WHERE descripcion = '" . io_safe_input('Logged in') . "' AND utimestamp > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - 3600) GROUP BY id_usuario, ip_origen, fecha, accion"; break; case "oracle": $sql = "SELECT id_usuario, ip_origen, fecha, accion