Closed (fixed)
Project:
Views (for Drupal 7)
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
18 Jun 2008 at 15:29 UTC
Updated:
7 Apr 2009 at 20:44 UTC
I've been getting an intermittent MySQL error that is cleared, oddly enough, by editing any view and saving it (making no changes to the view).
Here is the error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IN ('31','30')) ) ORDER BY node_created_created DESC LIMIT 0, 10' at line 1 query: SELECT DISTINCT(node.nid), node.created AS node_created_created, node.title AS node_title, node.changed AS node_changed, node.created AS node_created FROM node node INNER JOIN node_access na ON na.nid = node.nid LEFT JOIN node n ON node.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'term_access'))) AND ((n.moderate != 1)) AND ( (node.type IN ('news','share')) AND (.tid IN ('31','30')) ) ORDER BY node_created_created DESC LIMIT 0, 10 in /var/www/vhosts/empowher.com/httpdocs/includes/database.mysql.inc on line 172.
Can anyone provide any guidance as to what to be looking for. This seems to happen when new content is added (sometimes)
Thanks!
Comments
Comment #1
merlinofchaos commentedThere is a side effect of the taxonomy access module that causes views to forget about vocabularies that the current user cannot see when Views goes to refresh its cache. We've never come up with a fix for this.
Comment #2
amccann commentedThanks!
I did a search to see if Taxonomy_role had any similar known issues and couldn't find any.
Do you know of any.
Comment #3
merlinofchaos commentedThat query suggests taxonomy_access is installed:
na.realm = 'term_access'
I don't know anything about taxonomy_role, though.
Comment #4
zzelinski commentedWe're having a problem where Drupal will intermittently create an invalid SQL query when displaying one our our views. The view has a Taxonomy field displayed in the last column. What's weird is that the view works immediately after we create it - but then breaks spontaneously without anything changing in the view or underlying data. It can be "fixed" by merely opening the edit dialog and saving the view again, without changing anything, but it soon breaks again.
The SQL query includes a SELECT clause for "term_node_3.name". But, there is no table in our Drupal installation called term_node_3 (there is one called term_node). We found a reference to this table name in view_tablefield. It looks to me that Views is overloading the meaning of the "table" column to append the vocabulary table "vid" of the taxonomy we are displaying. But that is not getting stripped out appropriately.
The bad view is trying to access a non-existant table, "term_node_3". I think this is because of a hack that the Views module uses to encode the table name and the term number, into the table_name column of the view description.
I note that the working view does not even try to query the Taxonomy column - so Drupal must be making an additional query (for every row of my view?) to display the taxonomy column in my table view.
We have version 5.x-1.6 on our site. The error message is:
We have exported the view right after it broke, then saved it and exported the newly saved view, and a diff merely gives us this:
Any ideas?
Comment #5
merlinofchaos commentedzzelinski: I can tell you that term_node_3 is a Views alias for the term_node table with a specific join (vid = 3) and the lack of that table indicates you may be having a similar problem where the views data may be dropping out (causing term_node_3 to be unable to be joined in).
I suspect if you clear cache the problem will disappear, but it may reappear again later.
Comment #6
mikr commentedHi!
Do you have any idea when the problem with taxonomy access control and views could be fixed? Or do you have any suggestions how to prevent this from happening? I'm developing a site which relies heavily on the use of Views and TAC, and views stop working few times a day.
Comment #7
bgilday commentedI'm having a very similar problem. All of a sudden my view returns no results. Like the other posters, re-saving the view temporarily fixes the problem. I also have TAC installed and use it extensively on the site in question. I am willing to help fund a fix to this issue.
Comment #8
mikr commentedI haven't done re-saving, but cleared the views cache. This fixes the problem (also temporarily). I was wondering if using a cron job for clearing the cache would be a reasonable solution? Maybe call "views_invalidate_cache()" every 30 minutes or so?
Comment #9
domesticat commentedPerforming a mass closing of all issues over 180 days old. Please reopen if needed.