Hello,

After updating to Drupal 6.26, there is a query problem in the user module.
I use with PostgreSQL 8.4 and PHP 5.3.
First I did a research for this bug but no results.

Problem/Motivation

The problem is in user.module line 803:

$authenticated_users = db_query_range('SELECT u.uid, u.name, MAX(s.timestamp) AS timestamp FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.timestamp >= %d AND s.uid > 0 GROUP BY u.uid, u.name ORDER BY s.timestamp DESC', $interval, 0, $max_users);

s.timestamp is missing in the GROUP BY clause.

Proposed resolution

$authenticated_users = db_query_range('SELECT u.uid, u.name, MAX(s.timestamp) AS timestamp FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.timestamp >= %d AND s.uid > 0 GROUP BY u.uid, u.name, timestamp ORDER BY s.timestamp DESC', $interval, 0, $max_users);

I don't have experience creating a path file.

Thank you for this extraordinary project.

Alek

Comments

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.