[development] touchy mysql ordering

Gerhard Killesreiter gerhard at killesreiter.de
Sat Feb 11 08:56:16 UTC 2006


Tao Starbow wrote:

> Stop me if you've heard this one before.
>
> I recently upgraded the server running my Drupal site, and the events 
> calendar stopped working for everyone except user=1.  I tracked down 
> the problem to this (simplified) line of SQL:
> SELECT n.nid, e.event_start FROM {event} e INNER JOIN {node} n ON 
> n.nid = e.nid
> This returns all my events if the user=1, and zero if the user is 
> anyone else.
> However, if I rewrite the SQL as:
> SELECT n.nid, e.event_start FROM {node} n INNER JOIN {event} e ON 
> n.nid = e.nid
> then it behaves as I would expect, returning all events regardless of 
> who the user is.
>
> I did not have this problem on my old server, which was running mysql 
> 4.0.20-max.  The new server is running mysql 5.0.17.
>

This is not a mysql issue, but a simple bug in event.module. The 
rewriting of the query fails as it isn't in the form the regexp expects 
(I did say that using regexps is evil, did I?).
Please file a bug report for event.module so that I don't forget about 
it. A patch is also appreciated. The reason it doesn't happen for uid 1 
is that no rewriting takes place for that user.

Cheers,
    Gerhard


More information about the development mailing list