Help! Problem with Views/Taxonomy

Events happening in the community are now at Drupal community events on www.drupal.org.
mckoss's picture

We'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.

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.

We have the most up-to-date Views for 5.x on our site. So this bug doesn't seem to be fixed. Does anyone know anything about this - it's kind of driving us crazy to have our site sporadically crash like this.

Thanks!
Mike (and Zach)
StartPad.org

P.S. The view in question is at this URL:

http://startpad.org/services

(you'll need to sign up for a StartPad.org account in order to view it).

Comments

More Info

mckoss's picture

OK - my drupal views bug happened again. I managed to copy the failing SQL query. Then I re-edited the view, and used the Devel module to extract the new (working) query. They are both shown below.

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.

Can either of you shed any light on this bug. Unfortunately, we can go for days without this view failing - and then it will break again, the view looks corrupted, and we have to re-create the view again to get it to work.

--
Mike Koss
StartPad.org
Seattle Software Development Offices
(206) 388-3466


user warning: Unknown column 'term_node_3.name' in 'field list' query:

SELECT DISTINCT(node.nid), node.title AS node_title, node.changed AS node_changed, node_data_field_service_summary.field_service_summary_value AS node_data_field_service_summary_field_service_summary_value, node_data_field_website.field_website_url AS node_data_field_website_field_website_url, node_data_field_website.field_website_title AS node_data_field_website_field_website_title, node_data_field_website.field_website_attributes AS node_data_field_website_field_website_attributes, users.name AS users_name, users.uid AS users_uid, node_comment_statistics.comment_count AS node_comment_statistics_comment_count, term_node_3.name AS term_node_3_name, term_node_6.name AS term_node_6_name
FROM node node
LEFT JOIN content_type_service node_data_field_service_summary ON node.vid = node_data_field_service_summary.vid
LEFT JOIN content_field_website node_data_field_website ON node.vid = node_data_field_website.vid
INNER JOIN users users ON node.uid = users.uid
LEFT JOIN node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid
WHERE (node.type IN ('service')) LIMIT 0, 200

in /home/startpad/public_html/includes/database.mysql.inc on line 172.

Working Query:

SELECT node.nid, node.title AS node_title, node.changed AS node_changed, node_data_field_service_summary.field_service_summary_value AS node_data_field_service_summary_field_service_summary_value, node_data_field_website.field_website_url AS node_data_field_website_field_website_url, node_data_field_website.field_website_title AS node_data_field_website_field_website_title, node_data_field_website.field_website_attributes AS node_data_field_website_field_website_attributes, users.name AS users_name, users.uid AS users_uid, node_comment_statistics.comment_count AS node_comment_statistics_comment_count
FROM {node} node
LEFT JOIN {content_type_service} node_data_field_service_summary ON node.vid = node_data_field_service_summary.vid
LEFT JOIN {content_field_website} node_data_field_website ON node.vid = node_data_field_website.vid
INNER JOIN {users} users ON node.uid = users.uid
LEFT JOIN {node_comment_statistics} node_comment_statistics ON node.nid = node_comment_statistics.nid
WHERE (node.type IN ('service'))

Seattle

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: