Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Mar 2009 at 00:06 UTC
Updated:
1 May 2009 at 17:50 UTC
The query that shows up in the preview area isn't the query that's actually run. From what I can tell, if modules modify the query in hook_db_rewrite_sql, it isn't part of the printed query. In my case, much quality time with the debugger revealed that the query being run was actually:
SELECT DISTINCT(activity_messages.amid) AS amid,
activity_messages.everyone_message AS activity_messages_everyone_message,
activity_messages.author_message AS activity_messages_author_message,
activity_messages.uid AS activity_messages_uid
FROM {activity_messages} activity_messages
INNER JOIN {activity_access} aa ON activity_messages.amid = aa.amid WHERE ((aa.module = 'activity' AND aa.value IN (1)))
Unfortunately, the query view in the preview area shows this:
SELECT activity_messages.amid AS amid, activity_messages.everyone_message AS activity_messages_everyone_message, activity_messages.author_message AS activity_messages_author_message, activity_messages.uid AS activity_messages_uid FROM activity_messages activity_messages
The weird thing is that I can see the call to vpr on line 678 of view.inc where the debugger shows the correct query. I don't know why it doesn't show up. Thinking that it might be browser based, I verified that this happens both with Safari and Firefox.
Comments
Comment #1
merlinofchaos commentedThis is actually intended. The problem is that db_rewrite_sql can change how it rewrites the query based on who you are, what time it is, whether or not it had its morning coffee and how cranky it's feeling that day. These changes won't be obvious and I don't want to be held responsible for them. =)
Comment #2
mrothroc commentedOk. It might be a good idea to put a disclaimer in the display so folks know to check the actual query at the DB level if the displayed query doesn't seem right. Just a thought.