Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
Strange bug was found when I tried to create quite basic Taxonomy Term view with filter by selected taxonomy terms.
Here's view settings page: http://i.imgur.com/hXnAX.png
Here's screen with some terms selected for filter: http://i.imgur.com/LMeH8.png
Here's error message:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'taxonomy_term_data.nid' in 'IN/ALL/ANY subquery'
Here's query:
SELECT taxonomy_term_data.name AS taxonomy_term_data_name, taxonomy_term_data.vid AS taxonomy_term_data_vid, taxonomy_term_data.tid AS tid, taxonomy_vocabulary.machine_name AS taxonomy_vocabulary_machine_name
FROM
{taxonomy_term_data} taxonomy_term_data
LEFT JOIN {taxonomy_vocabulary} taxonomy_vocabulary ON taxonomy_term_data.vid = taxonomy_vocabulary.vid
WHERE (( (taxonomy_vocabulary.machine_name IN ('categories')) AND (taxonomy_term_data.nid IN (SELECT tn.nid AS nid
FROM
{taxonomy_index} tn
WHERE (tn.tid IN ('72', '58', '59', '75')) )) ))
May be issue caused by line 436 of views_handler_filter_term_node_tid.inc file:
432 $subquery = db_select('taxonomy_index', 'tn');
433 $subquery->addField('tn', 'nid');
434 $last = 'tn';
435 $subquery->condition('tn.tid', $tid, $operator);
436 $this->query->add_where($this->options['group'], "$this->table_alias.nid", $subquery, 'IN');
Could you please advice?
Thanks!
Comments
Comment #1
yurg CreditAttribution: yurg commentedJust in case someone interested: I made code modification (taxonomy_index in query was replaced by taxonomy_term_data), so now filter works as expected.
Not sure if patch should be made since have no idea about any unintended consequences caused by code changes.
Comment #2
yurg CreditAttribution: yurg as a volunteer commented