Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.6
Component:
taxonomy data
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 May 2009 at 21:55 UTC
Updated:
9 Jul 2010 at 00:34 UTC
I recently upgraded to 2.5, and one of my views stopped working. I get the error "user warning: Unknown column 'term_data.name' in 'field list' query". Seems to have to do with using taxonomy terms together (one as an argument, one as a filter).
I've tried many combinations of dropping, re-adding the argument and filters. As soon as I add an argument with "Allow multiple arguments to work together." and pass a valid argument, I see the error message.
Thank you in advance!
View:
$view = new view;
$view->name = 'Toolkit';
$view->description = '';
$view->tag = 'toolkit';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'parent' => array(
'id' => 'parent',
'table' => 'term_hierarchy',
'field' => 'parent',
),
));
$handler->override_option('fields', array(
'view_node' => array(
'label' => '',
'text' => '',
'exclude' => 1,
'id' => 'view_node',
'table' => 'node',
'field' => 'view_node',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'title' => array(
'label' => '',
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'type' => array(
'label' => '',
'link_to_node' => 0,
'exclude' => 1,
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'name' => array(
'label' => '',
'link_to_taxonomy' => 0,
'exclude' => 1,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'name' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '%1 Toolkit',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 0,
'limit' => '0',
'case' => 'lower',
'path_case' => 'lower',
'transform_dash' => 0,
'add_table' => 1,
'require_value' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'webform' => 0,
'deadlines' => 0,
'events' => 0,
'ithsservices' => 0,
'news' => 0,
'page' => 0,
'resourcecenter' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'3' => 0,
'7' => 0,
'6' => 0,
'8' => 0,
'10' => 0,
'9' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'vid' => array(
'operator' => 'in',
'value' => array(
'10' => '10',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'vid',
'table' => 'term_data',
'field' => 'vid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('header', ' ');
$handler->override_option('header_format', '3');
$handler->override_option('header_empty', 0);
$handler->override_option('items_per_page', 1000);
$handler->override_option('distinct', 1);
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
'grouping' => 'name',
'type' => 'ul',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('relationships', array(
'parent' => array(
'label' => 'Parent',
'required' => 0,
'id' => 'parent',
'table' => 'term_hierarchy',
'field' => 'parent',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'weight' => array(
'order' => 'ASC',
'id' => 'weight',
'table' => 'term_data',
'field' => 'weight',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'title' => array(
'order' => 'ASC',
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'name' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '%1 Researcher Toolkit',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 0,
'limit' => '0',
'case' => 'ucfirst',
'path_case' => 'lower',
'transform_dash' => 0,
'add_table' => 1,
'require_value' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'webform' => 0,
'deadlines' => 0,
'events' => 0,
'ithsservices' => 0,
'news' => 0,
'page' => 0,
'resourcecenter' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'3' => 0,
'7' => 0,
'6' => 0,
'8' => 0,
'10' => 0,
'9' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
));
$handler->override_option('path', 'toolkit/%');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
Query:
SELECT DISTINCT(node.nid) AS nid,
node.title AS node_title,
node.type AS node_type,
term_data.name AS term_data_name,
term_data.vid AS term_data_vid,
term_data.tid AS term_data_tid,
term_data.weight AS term_data_weight
FROM db1node node
LEFT JOIN db1term_node term_node ON node.vid = term_node.vid
LEFT JOIN db1term_node term_data ON node.vid = term_data.vid
LEFT JOIN db1term_hierarchy term_hierarchy ON term_data.tid = term_hierarchy.tid
LEFT JOIN db1term_data term_data_term_hierarchy ON term_hierarchy.parent = term_data_term_hierarchy.tid
LEFT JOIN db1term_data term_data__term_data ON term_data.tid = term_data__term_data.tid
WHERE (node.status <> 0) AND (term_data.vid in ('10')) AND (term_data__term_data.name = 't0')
ORDER BY term_data_weight ASC, node_title ASC
Comments
Comment #1
seattlehimay commentedIn case it matters, I had recently upgraded from 2.3 to 2.5.
Comment #2
gayatri.sa commentedI have the same issue....since I couldn't find a fix I down graded to 2.3 and all is well again...!
Comment #3
agogo commentedI also have the same issue. When using a term name as an argument and at the same time using another vocabulary and term in filter all is well in 2.3 but when upgrading to 2.5 the result doesnt display anything. It seems the SQL is wrong (yes?)
FYI I needed the upgrade since Fivestars didnt work in 2.3.
Query:
Comment #4
seattlehimay commentedUpdating. Problem still exists in 2.6.
Comment #5
seattlehimay commentedAny ideas on this? How can I get multiple taxonomies to work together? This worked in 2.3, but does not work now. I get the error:
Example: A node is tagged with X,Y,Z but also A,B,C. I want to pass "X" into the URL, then use the other taxonomy terms (A,B,C) as the grouping terms for the HTML list.
So the page would look like:
A
---------
- Link to a node labeled with X and A
- Link to a node labeled with X and A
B
-------
- Link to a node labeled with X and B
C
--------
- Link to a node labeled with X and C
Of course, X is an argument passed in the URL, so I would have similar pages for Y and Z.
Comment #6
akhodakovskiy commentedsubscribing
Comment #7
jonathanpglick commentedI just upgraded from 2.2 to 2.6 and I'm having the same problem when using two Taxonomy: Term arguments. Below is the full SQL:
The problem seems to be on the second LEFT JOIN where it's referencing the term_node table where it should be term_data (i think):
The same problem is shown in the SQL of seattlehimay's first post. What is the last release without this issue? I see people reverting to 2.3, does 2.4 have this problem as well?
Comment #8
jonathanpglick commentedNot sure if this will help everyone but this bug report (http://drupal.org/node/428742) mentions the checking the 'Allow multiple arguments to work together' checkbox. It solved my problems.
Comment #9
agogo commentedYou have got to be kidding. Yes. It solved my problems.
How could Ive been so stupid. I almost ignored your comment cause of its simplicity. That would have been my bad, definitely.
Thanks Jonathan!
Comment #10
ss_drupal commentedUm, at the risk of sounding dumb, what does the "__" syntax mean in the expression,
LEFT JOIN term_data term_data__term_data ON term_data.tid = term_data__term_data.tid AND term_data__term_data.name != 'some-term-name'
Can you point me to documentation somewhere?
Thanks
Comment #11
brush commentedfwiw, the fix listed (clicking the "play nice with others" button) does not deal with all issues. in my case, it solves the problem in preview, but not on the live site. (i have purged views cache, and all drupal caches). reverting to 2.3 solves the problem.
any ideas why something might solved in preview but not live?
Comment #12
esmerel commentedThis issue is a year old, it's likely either resolved or no longer relevant.