http://drupal.org/node/78642

It looks like an issue has been identified now that affects 4.6.x installations when using MySQL 4.1.21. I've logged this under 4.6.9 as that is what people should be using now but there are reports of it happening on earlier versions. Noone has yet reported it on 4.7.x as far as I can see.

The symptom is that the order of node teasers on the front page isn't sorted by DESC for users with the administration role. There was a bug fix in MySQL 4.1.21 that relates to ORDER BY and it looks like DESC is being discarded because the query is structured in a way that is not compatible with this version of MySQL.

I confess I don't know where to even look for the query involved but I was hoping people here could help.

This post on the MySQL forums describes what could be happening.
http://forums.mysql.com/read.php?20,106815,106923#msg-106923

Comments

Cromicon’s picture

Status: Active » Closed (duplicate)

Ach. Someone posted this earlier and I didn't see it. I think I got more info though. ;-)

http://drupal.org/node/79217

Cromicon’s picture

Status: Closed (duplicate) » Active

As the other issue has been altered from 4.6.9 to 4.7.3 this issue is now for 4.6.9

Relevant info can still be found on the other issue but those with 4.6.9 may as well post here with the info requested by webschick:
submitted by webchick on August 18, 2006 - 17:00

Could someone install and enable devel module and turn on query log and paste the difference in content queries between the anonymous user's view and the admin or whoever gets this difference view? It'll be something like:

SELECT [a bunch of fields] FROM node n INNER JOIN [a bunch of tables] ORDER BY n.created DESC

Cromicon’s picture

og enabled 4.6.9 admin view where order is not correct:

0.07 1 SELECT DISTINCT(n.nid), n.title, u.uid, u.name FROM node_counter s INNER JOIN node n ON s.nid = n.nid INNER JOIN users u ON n.uid = u.uid WHERE s.daycount <> '0' AND n.status = 1 ORDER BY s.daycount DESC LIMIT 0, 1
0.07 1 SELECT DISTINCT(n.nid), n.title, u.uid, u.name FROM node_counter s INNER JOIN node n ON s.nid = n.nid INNER JOIN users u ON n.uid = u.uid WHERE s.totalcount <> '0' AND n.status = 1 ORDER BY s.totalcount DESC LIMIT 0, 1
0.07 1 SELECT DISTINCT(n.nid), n.title, u.uid, u.name FROM node_counter s INNER JOIN node n ON s.nid = n.nid INNER JOIN users u ON n.uid = u.uid WHERE s.timestamp <> '0' AND n.status = 1 ORDER BY s.timestamp DESC LIMIT 0, 1

og enable 4.6.9 anonymous user view where correct:

0.08 1 SELECT DISTINCT(n.nid), n.title, u.uid, u.name FROM node_counter s INNER JOIN node_access na ON na.nid = n.nid INNER JOIN node n ON s.nid = n.nid INNER JOIN users u ON n.uid = u.uid WHERE (na.grant_view >= 1 AND CONCAT(na.realm, na.gid) IN ('all0','og_group0')) AND s.daycount <> '0' AND n.status = 1 ORDER BY s.daycount DESC LIMIT 0, 1
0.08 1 SELECT DISTINCT(n.nid), n.title, u.uid, u.name FROM node_counter s INNER JOIN node_access na ON na.nid = n.nid INNER JOIN node n ON s.nid = n.nid INNER JOIN users u ON n.uid = u.uid WHERE (na.grant_view >= 1 AND CONCAT(na.realm, na.gid) IN ('all0','og_group0')) AND s.totalcount <> '0' AND n.status = 1 ORDER BY s.totalcount DESC LIMIT 0, 1
0.08 1 SELECT DISTINCT(n.nid), n.title, u.uid, u.name FROM node_counter s INNER JOIN node_access na ON na.nid = n.nid INNER JOIN node n ON s.nid = n.nid INNER JOIN users u ON n.uid = u.uid WHERE (na.grant_view >= 1 AND CONCAT(na.realm, na.gid) IN ('all0','og_group0')) AND s.timestamp <> '0' AND n.status = 1 ORDER BY s.timestamp DESC LIMIT 0, 1
Cromicon’s picture

See http://drupal.org/node/79217 for a possible fix that needs testing. On initial testing this appears to work for 4.6.9 with OG. Your mileage may vary so backup the node.module before trying. It does look good though and props to unionweb for suggesting a possible fix.

Cromicon’s picture

Newly created nodes are not deletable. Do not try yet if with OG.

Cromicon’s picture

Seems to be okay now...maybe I had a weird caching issue but looks good so far using the fix unionweb proposed

magico’s picture

Status: Active » Closed (fixed)

As discussed in the other issue the problem happens with a mysql specific version.
This is not a Drupal bug, but a workaround was made to help some users.