To simulate the bug:
Click menu 'My Subscriptions'
Click on 'Rss fee' tab
Displays the rss xml
Click back button on browser
Now click on any of the other tabs in my subscription (threads, categories, content type)
You get:

user warning: Invalid use of group function query: SELECT n.nid FROM node n LEFT JOIN term_node tn ON n.nid=tn.nid GROUP BY n.nid ORDER BY MAX(n.created) DESC LIMIT 0, 10 in /home/test/public_html/sandbox/includes/database.mysql.inc on line 120.

Comments

drupalzack’s picture

Fresh installation of 4.7.2 and subscriptions module (tried both cvs and reg).

One thing you have to do is to enable 'my subscription' menu in the nav block and use that and not the one that's under my account/subscription.

Tried with/without clean url. Same error. But if I click on the tab again, it goes away. but each time I click on the feed icon and then on one of the subscription tabs, I get this error. Clicking the same tab again and the error goes away.

drupalzack’s picture

Digging some more, this is definitely a bug in mysql 4.x but not 5.x.

The patch is

$sql = "SELECT n.nid, max( n.created ) AS nc FROM {node} n LEFT JOIN {term_node} tn ON n.nid=tn.nid";
if ($cond) {
$sql.= " WHERE ". implode(' OR ', $cond);
}
$sql .= " GROUP BY n.nid ORDER BY nc DESC";
$result = db_query_range(db_rewrite_sql($sql), 0, variable_get('feed_default_items', 10));
$channel['title'] = t("%name Subscriptions", array('%name' => $account->name));
$channel['link'] = url("subscriptions/feed", NULL, NULL, TRUE);
// $channel['description'] = ;
node_feed($result, $channel);

at the end of subscription.module. Note alias for the order by clause. Mysql 4.x cannot parse that without an error. Mysql 5.0 is fine with it.

Thanks

sanduhrs’s picture

Status: Active » Needs review
StatusFileSize
new1.1 KB

I can confirm this bug.
The provided solution seems to work, so here the patch.

moshe weitzman’s picture

bug is confirmed by me too. haven't tested patch.

dziemecki’s picture

Assigned: Unassigned » dziemecki

Please do test the patch. I'm running Drupal 4.7 on PHP 4.x, and I can't dupe the error.

JHeffner’s picture

I had the same error in my logs with incorrect feed information being included in the rss feed as well. I applied the patch and it resolves the issue for me.

Drupal 4.7.3 w/ PHP 4.3.9

lmw94002’s picture

With: Drupal 4.7.4, MySQL 4.1.11 & PHP 5.0.4

I experienced the error. The patch above did seem to successfully correct the issue for my installation.

dziemecki’s picture

Status: Needs review » Fixed

Corrected code committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)